﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;

namespace Darkmoon.DX11Imported
{
    #region Helper
    [StructLayout(LayoutKind.Sequential)]
    public class LP_IUnknown
    {
        [MarshalAs(UnmanagedType.IUnknown)] protected object _Value;
        public object Value
        {
            get { return _Value; }
            set { _Value = value; }
        }
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_IUnknown<T> : LP_IUnknown
    {
        public T Value
        {
            get { return (T)_Value; }
            set { _Value = value; }
        }
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_Struct<T> where T : struct
    {
        public T Value;
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_UInt32 : LP_Struct<UInt32> { }
    #endregion

    public static class DX11_Guids_And_Consts
    {
        public static readonly Guid WKPDID_D3DDebugObjectName = new Guid("{0x429b8c22,0x9188,0x4b0c,{0x87,0x42,0xac,0xb0,0xbf,0x85,0xc2,0x00}}");
        public static readonly Guid IID_IDXGIDevice = new Guid("54ec77fa-1377-44e6-8c32-88fd5f44c84c");
        public static readonly Guid IID_ID3D11Texture2D = new Guid("6f15aaf2-d208-4e89-9ab4-489535d34f9c");
        public static readonly Guid IID_IDXGIAdapter = new Guid("2411e7e1-12ac-4ccf-bd14-9798e8534dc0");
        public const uint D3D11_PS_CS_UAV_REGISTER_COUNT = 8;
        public const uint D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT = 128;
        public const uint D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT = 14;
        public const uint D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE = 16;
        public const uint D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT = 8;
        public const uint D3D11_SO_NO_RASTERIZED_STREAM = 0xffffffff;
        #region Legacy
        #region DX9
        public const uint D3D_SDK_VERSION = 32;
        #endregion
        #endregion
    }

    public static class DX11ImportLib_GlobalMethods
    {
        #region Legacy
        #region DX9
        [DllImport("d3d9.dll", EntryPoint = "Direct3DCreate9Ex"), System.Security.SuppressUnmanagedCodeSecurity]
        public static extern int Direct3DCreate9Ex(                                                         //HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex**);
            uint SDKVersion,
            out IDirect3D9Ex ppD3D
            );
        #endregion
        #endregion

        #region Confirmed Methods
        #region CopyMemory
        [DllImport("kernel32.dll", EntryPoint = "CopyMemory"), System.Security.SuppressUnmanagedCodeSecurity]
        public static extern void CopyMemory(
            IntPtr Destination,
            IntPtr Source,
            uint Length
            );
        [DllImport("kernel32.dll", EntryPoint = "CopyMemory"), System.Security.SuppressUnmanagedCodeSecurity]
        public unsafe static extern void CopyMemory(
            void* Destination,
            void* Source,
            uint Length
            );
        #endregion

        [DllImport("d3d11.dll", EntryPoint = "D3D11CreateDevice"), System.Security.SuppressUnmanagedCodeSecurity]
        public static extern int D3D11CreateDevice(                                                         //HRESULT WINAPI D3D11CreateDevice(
            IDXGIAdapter pAdapter,                                                                          //__in_opt IDXGIAdapter* pAdapter
            D3D_DRIVER_TYPE DriverType,                                                                     //D3D_DRIVER_TYPE DriverType
            IntPtr Software,                                                                                //HMODULE Software
            D3D11_CREATE_DEVICE_FLAG Flags,                                                                 //UINT Flags
            [MarshalAs(UnmanagedType.LPArray), In] D3D_FEATURE_LEVEL[] pFeatureLevels,                      //__in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels
            uint FeatureLevels,                                                                             //UINT FeatureLevels
            DX_SDK_VERSIONS SDKVersion,                                                                     //UINT SDKVersion
            [MarshalAs(UnmanagedType.LPStruct), Out] LP_ID3D11Device ppDevice = null,                       //__out_opt ID3D11Device** ppDevice
            [MarshalAs(UnmanagedType.LPStruct), Out] LP_D3D_FEATURE_LEVEL pFeatureLevel = null,             //__out_opt D3D_FEATURE_LEVEL* pFeatureLevel
            [MarshalAs(UnmanagedType.LPStruct), Out] LP_ID3D11DeviceContext ppImmediateContext = null       //__out_opt ID3D11DeviceContext** ppImmediateContext
            );

        [DllImport("d3d11.dll", EntryPoint = "D3D11CreateDeviceAndSwapChain"), System.Security.SuppressUnmanagedCodeSecurity]
        public static extern int D3D11CreateDeviceAndSwapChain(                                             //HRESULT WINAPI D3D11CreateDeviceAndSwapChain(
            IDXGIAdapter pAdapter,                                                                          //__in_opt IDXGIAdapter* pAdapter,
            D3D_DRIVER_TYPE DriverType,                                                                     //D3D_DRIVER_TYPE DriverType,
            IntPtr Software,                                                                                //HMODULE Software,
            D3D11_CREATE_DEVICE_FLAG Flags,                                                                 //UINT Flags,
            [MarshalAs(UnmanagedType.LPArray), In] D3D_FEATURE_LEVEL[] pFeatureLevels,                      //__in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
            uint FeatureLevels,                                                                             //UINT FeatureLevels,
            DX_SDK_VERSIONS SDKVersion,                                                                     //UINT SDKVersion,
            [MarshalAs(UnmanagedType.LPStruct), In] LP_DXGI_SWAP_CHAIN_DESC pSwapChainDesc = null,          //__in_opt CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc,
            [MarshalAs(UnmanagedType.LPStruct), Out] LP_IDXGISwapChain ppSwapChain = null,                  //__out_opt IDXGISwapChain** ppSwapChain,
            [MarshalAs(UnmanagedType.LPStruct), Out] LP_ID3D11Device ppDevice = null,                       //__out_opt ID3D11Device** ppDevice,
            [MarshalAs(UnmanagedType.LPStruct), Out] LP_D3D_FEATURE_LEVEL pFeatureLevel = null,             //__out_opt D3D_FEATURE_LEVEL* pFeatureLevel,
            [MarshalAs(UnmanagedType.LPStruct), Out] LP_ID3D11DeviceContext ppImmediateContext = null       //__out_opt ID3D11DeviceContext** ppImmediateContext );
            );
        #endregion

        #region Extensions
        #region D3D11CreateDevice
        [DllImport("d3d11.dll", EntryPoint = "D3D11CreateDevice"), System.Security.SuppressUnmanagedCodeSecurity]
        public static extern int D3D11CreateDevice(                                                        //HRESULT WINAPI D3D11CreateDevice(
            IDXGIAdapter pAdapter,                                                                          //__in_opt IDXGIAdapter* pAdapter,
            D3D_DRIVER_TYPE DriverType,                                                                     //D3D_DRIVER_TYPE DriverType,
            IntPtr Software,                                                                                //HMODULE Software,
            D3D11_CREATE_DEVICE_FLAG Flags,                                                                 //UINT Flags,
            [MarshalAs(UnmanagedType.LPArray), In] D3D_FEATURE_LEVEL[] pFeatureLevels,                      //__in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
            uint FeatureLevels,                                                                             //UINT FeatureLevels,
            DX_SDK_VERSIONS SDKVersion,                                                                     //UINT SDKVersion,
            IntPtr ppDevice,                                                                                //__out_opt ID3D11Device** ppDevice,
            IntPtr pFeatureLevel,                                                                           //__out_opt D3D_FEATURE_LEVEL* pFeatureLevel,
            IntPtr ppImmediateContext                                                                       //__out_opt ID3D11DeviceContext** ppImmediateContext );
            );
        [DllImport("d3d11.dll", EntryPoint = "D3D11CreateDevice"), System.Security.SuppressUnmanagedCodeSecurity]
        public static extern int D3D11CreateDevice(
            IDXGIAdapter pAdapter,                                                                          //__in_opt IDXGIAdapter* pAdapter,
            D3D_DRIVER_TYPE DriverType,                                                                     //D3D_DRIVER_TYPE DriverType,
            IntPtr Software,                                                                                //HMODULE Software,
            D3D11_CREATE_DEVICE_FLAG Flags,                                                                 //UINT Flags,
            [MarshalAs(UnmanagedType.LPArray), In] D3D_FEATURE_LEVEL[] pFeatureLevels,                      //__in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
            uint FeatureLevels,                                                                             //UINT FeatureLevels,
            DX_SDK_VERSIONS SDKVersion,                                                                     //UINT SDKVersion,
            [Out] out ID3D11Device ppDevice,                                                                //__out_opt ID3D11Device** ppDevice,
            [Out] out D3D_FEATURE_LEVEL pFeatureLevel,                                                      //__out_opt D3D_FEATURE_LEVEL* pFeatureLevel,
            [Out] out ID3D11DeviceContext ppImmediateContext                                                //__out_opt ID3D11DeviceContext** ppImmediateContext );
            );
        public static int D3D11CreateDevice(
            IDXGIAdapter pAdapter,                                                                          //__in_opt IDXGIAdapter* pAdapter,
            D3D_DRIVER_TYPE DriverType,                                                                     //D3D_DRIVER_TYPE DriverType,
            IntPtr Software,                                                                                //HMODULE Software,
            D3D11_CREATE_DEVICE_FLAG Flags,                                                                 //UINT Flags,
            D3D_FEATURE_LEVEL[] pFeatureLevels,                                                             //__in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
            uint FeatureLevels,                                                                             //UINT FeatureLevels,
            DX_SDK_VERSIONS SDKVersion,                                                                     //UINT SDKVersion,
            out ID3D11Device ppDevice,                                                                      //__out_opt ID3D11Device** ppDevice,
            out D3D_FEATURE_LEVEL pFeatureLevel//,                                                          //__out_opt D3D_FEATURE_LEVEL* pFeatureLevel,
            //out ID3D11DeviceContext ppImmediateContext                                                    //__out_opt ID3D11DeviceContext** ppImmediateContext );
            )
        {
            int rv = 0;
            ppDevice = null;
            pFeatureLevel = new D3D_FEATURE_LEVEL();
            unsafe
            {
                void* pDevice;
                fixed (void* ptrFeatureLevel = &pFeatureLevel)
                {
                    rv = D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, new IntPtr(&pDevice), new IntPtr(ptrFeatureLevel), IntPtr.Zero);
                }
                ppDevice = (ID3D11Device)Marshal.GetObjectForIUnknown(new IntPtr(pDevice));
                Marshal.Release(new IntPtr(pDevice));
            }
            return rv;
        }
        public static int D3D11CreateDevice(
            IDXGIAdapter pAdapter,                                                                          //__in_opt IDXGIAdapter* pAdapter,
            D3D_DRIVER_TYPE DriverType,                                                                     //D3D_DRIVER_TYPE DriverType,
            IntPtr Software,                                                                                //HMODULE Software,
            D3D11_CREATE_DEVICE_FLAG Flags,                                                                 //UINT Flags,
            D3D_FEATURE_LEVEL[] pFeatureLevels,                                                             //__in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
            uint FeatureLevels,                                                                             //UINT FeatureLevels,
            DX_SDK_VERSIONS SDKVersion,                                                                     //UINT SDKVersion,
            out ID3D11Device ppDevice,                                                                      //__out_opt ID3D11Device** ppDevice,
            //out D3D_FEATURE_LEVEL pFeatureLevel,                                                          //__out_opt D3D_FEATURE_LEVEL* pFeatureLevel,
            out ID3D11DeviceContext ppImmediateContext                                                      //__out_opt ID3D11DeviceContext** ppImmediateContext );
            )
        {
            int rv = 0;
            ppDevice = null;
            ppImmediateContext = null;
            unsafe
            {
                void* pDevice;
                void* pImmediateContext;
                rv = D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, new IntPtr(&pDevice), IntPtr.Zero, new IntPtr(&pImmediateContext));
                ppDevice = (ID3D11Device)Marshal.GetObjectForIUnknown(new IntPtr(pDevice));
                Marshal.Release(new IntPtr(pDevice));
                ppImmediateContext = (ID3D11DeviceContext)Marshal.GetObjectForIUnknown(new IntPtr(pImmediateContext));
                Marshal.Release(new IntPtr(pImmediateContext));
            }
            return rv;
        }
        public static int D3D11CreateDevice(
            IDXGIAdapter pAdapter,                                                                          //__in_opt IDXGIAdapter* pAdapter,
            D3D_DRIVER_TYPE DriverType,                                                                     //D3D_DRIVER_TYPE DriverType,
            IntPtr Software,                                                                                //HMODULE Software,
            D3D11_CREATE_DEVICE_FLAG Flags,                                                                 //UINT Flags,
            D3D_FEATURE_LEVEL[] pFeatureLevels,                                                             //__in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
            uint FeatureLevels,                                                                             //UINT FeatureLevels,
            DX_SDK_VERSIONS SDKVersion,                                                                     //UINT SDKVersion,
            out ID3D11Device ppDevice//,                                                                    //__out_opt ID3D11Device** ppDevice,
            //out D3D_FEATURE_LEVEL pFeatureLevel,                                                          //__out_opt D3D_FEATURE_LEVEL* pFeatureLevel,
            //out ID3D11DeviceContext ppImmediateContext                                                    //__out_opt ID3D11DeviceContext** ppImmediateContext );
            )
        {
            int rv = 0;
            ppDevice = null;
            unsafe
            {
                void* pDevice;
                rv = D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, new IntPtr(&pDevice), IntPtr.Zero, IntPtr.Zero);
                ppDevice = (ID3D11Device)Marshal.GetObjectForIUnknown(new IntPtr(pDevice));
                Marshal.Release(new IntPtr(pDevice));
            }
            return rv;
        }
        public static int D3D11CreateDevice(
            IDXGIAdapter pAdapter,                                                                          //__in_opt IDXGIAdapter* pAdapter,
            D3D_DRIVER_TYPE DriverType,                                                                     //D3D_DRIVER_TYPE DriverType,
            IntPtr Software,                                                                                //HMODULE Software,
            D3D11_CREATE_DEVICE_FLAG Flags,                                                                 //UINT Flags,
            D3D_FEATURE_LEVEL[] pFeatureLevels,                                                             //__in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
            uint FeatureLevels,                                                                             //UINT FeatureLevels,
            DX_SDK_VERSIONS SDKVersion,                                                                     //UINT SDKVersion,
            //out ID3D11Device ppDevice,                                                                    //__out_opt ID3D11Device** ppDevice,
            out D3D_FEATURE_LEVEL pFeatureLevel,                                                            //__out_opt D3D_FEATURE_LEVEL* pFeatureLevel,
            out ID3D11DeviceContext ppImmediateContext                                                      //__out_opt ID3D11DeviceContext** ppImmediateContext );
            )
        {
            int rv = 0;
            pFeatureLevel = new D3D_FEATURE_LEVEL();
            ppImmediateContext = null;
            unsafe
            {
                void* pImmediateContext;
                fixed (void* ptrFeatureLevel = &pFeatureLevel)
                {
                    rv = D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, IntPtr.Zero, new IntPtr(ptrFeatureLevel), new IntPtr(&pImmediateContext));
                }
                ppImmediateContext = (ID3D11DeviceContext)Marshal.GetObjectForIUnknown(new IntPtr(pImmediateContext));
                Marshal.Release(new IntPtr(pImmediateContext));
            }
            return rv;
        }
        public static int D3D11CreateDevice(
            IDXGIAdapter pAdapter,                                                                          //__in_opt IDXGIAdapter* pAdapter,
            D3D_DRIVER_TYPE DriverType,                                                                     //D3D_DRIVER_TYPE DriverType,
            IntPtr Software,                                                                                //HMODULE Software,
            D3D11_CREATE_DEVICE_FLAG Flags,                                                                 //UINT Flags,
            D3D_FEATURE_LEVEL[] pFeatureLevels,                                                             //__in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
            uint FeatureLevels,                                                                             //UINT FeatureLevels,
            DX_SDK_VERSIONS SDKVersion,                                                                     //UINT SDKVersion,
            //out ID3D11Device ppDevice,                                                                    //__out_opt ID3D11Device** ppDevice,
            out D3D_FEATURE_LEVEL pFeatureLevel//,                                                          //__out_opt D3D_FEATURE_LEVEL* pFeatureLevel,
            //out ID3D11DeviceContext ppImmediateContext                                                    //__out_opt ID3D11DeviceContext** ppImmediateContext );
            )
        {
            int rv = 0;
            pFeatureLevel = new D3D_FEATURE_LEVEL();
            unsafe
            {
                fixed (void* ptrFeatureLevel = &pFeatureLevel)
                {
                    rv = D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, IntPtr.Zero, new IntPtr(ptrFeatureLevel), IntPtr.Zero);
                }
            }
            return rv;
        }
        public static int D3D11CreateDevice(
            IDXGIAdapter pAdapter,                                                                          //__in_opt IDXGIAdapter* pAdapter,
            D3D_DRIVER_TYPE DriverType,                                                                     //D3D_DRIVER_TYPE DriverType,
            IntPtr Software,                                                                                //HMODULE Software,
            D3D11_CREATE_DEVICE_FLAG Flags,                                                                 //UINT Flags,
            D3D_FEATURE_LEVEL[] pFeatureLevels,                                                             //__in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
            uint FeatureLevels,                                                                             //UINT FeatureLevels,
            DX_SDK_VERSIONS SDKVersion,                                                                     //UINT SDKVersion,
            //out ID3D11Device ppDevice,                                                                    //__out_opt ID3D11Device** ppDevice,
            //out D3D_FEATURE_LEVEL pFeatureLevel,                                                          //__out_opt D3D_FEATURE_LEVEL* pFeatureLevel,
            out ID3D11DeviceContext ppImmediateContext                                                      //__out_opt ID3D11DeviceContext** ppImmediateContext );
            )
        {
            int rv = 0;
            ppImmediateContext = null;
            unsafe
            {
                void* pImmediateContext;
                rv = D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, IntPtr.Zero, IntPtr.Zero, new IntPtr(&pImmediateContext));
                ppImmediateContext = (ID3D11DeviceContext)Marshal.GetObjectForIUnknown(new IntPtr(pImmediateContext));
                Marshal.Release(new IntPtr(pImmediateContext));
            }
            return rv;
        }
        public static int D3D11CreateDevice(
            IDXGIAdapter pAdapter,                                                                          //__in_opt IDXGIAdapter* pAdapter,
            D3D_DRIVER_TYPE DriverType,                                                                     //D3D_DRIVER_TYPE DriverType,
            IntPtr Software,                                                                                //HMODULE Software,
            D3D11_CREATE_DEVICE_FLAG Flags,                                                                 //UINT Flags,
            D3D_FEATURE_LEVEL[] pFeatureLevels,                                                             //__in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
            uint FeatureLevels,                                                                             //UINT FeatureLevels,
            DX_SDK_VERSIONS SDKVersion//,                                                                   //UINT SDKVersion,
            //out ID3D11Device ppDevice,                                                                    //__out_opt ID3D11Device** ppDevice,
            //out D3D_FEATURE_LEVEL pFeatureLevel,                                                          //__out_opt D3D_FEATURE_LEVEL* pFeatureLevel,
            //out ID3D11DeviceContext ppImmediateContext                                                    //__out_opt ID3D11DeviceContext** ppImmediateContext );
            )
        {
            return D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
        }
        public static int D3D11CreateDevice(
            out ID3D11Device ppDevice,
            out ID3D11DeviceContext ppImmediateContext,
            IDXGIAdapter pAdapter = null,
            D3D_DRIVER_TYPE DriverType = D3D_DRIVER_TYPE.D3D_DRIVER_TYPE_HARDWARE,
            IntPtr Software = default(IntPtr),
            D3D11_CREATE_DEVICE_FLAG Flags = 0,
            D3D_FEATURE_LEVEL[] pFeatureLevels = null,
            DX_SDK_VERSIONS SDKVersion = DX_SDK_VERSIONS.D3D11_SDK_VERSION
            )
        {
            return D3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, pFeatureLevels == null ? 0 : (uint)pFeatureLevels.Length, SDKVersion, out ppDevice, out ppImmediateContext);
        }
        #endregion
        #region D3D11CreateDeviceAndSwapChain
        [DllImport("d3d11.dll", EntryPoint = "D3D11CreateDeviceAndSwapChain"), System.Security.SuppressUnmanagedCodeSecurity]
        public static extern int D3D11CreateDeviceAndSwapChain(                                             //HRESULT WINAPI D3D11CreateDeviceAndSwapChain(
            IDXGIAdapter pAdapter,                                                                          //__in_opt IDXGIAdapter* pAdapter,
            D3D_DRIVER_TYPE DriverType,                                                                     //D3D_DRIVER_TYPE DriverType,
            IntPtr Software,                                                                                //HMODULE Software,
            D3D11_CREATE_DEVICE_FLAG Flags,                                                                 //UINT Flags,
            [MarshalAs(UnmanagedType.LPArray), In] D3D_FEATURE_LEVEL[] pFeatureLevels,                      //__in_ecount_opt( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels,
            uint FeatureLevels,                                                                             //UINT FeatureLevels,
            DX_SDK_VERSIONS SDKVersion,                                                                     //UINT SDKVersion,
            IntPtr pSwapChainDesc,                                                                          //__in_opt CONST DXGI_SWAP_CHAIN_DESC* pSwapChainDesc,
            [MarshalAs(UnmanagedType.LPStruct), Out] LP_IDXGISwapChain ppSwapChain = null,                  //__out_opt IDXGISwapChain** ppSwapChain,
            [MarshalAs(UnmanagedType.LPStruct), Out] LP_ID3D11Device ppDevice = null,                       //__out_opt ID3D11Device** ppDevice,
            [MarshalAs(UnmanagedType.LPStruct), Out] LP_D3D_FEATURE_LEVEL pFeatureLevel = null,             //__out_opt D3D_FEATURE_LEVEL* pFeatureLevel,
            [MarshalAs(UnmanagedType.LPStruct), Out] LP_ID3D11DeviceContext ppImmediateContext = null       //__out_opt ID3D11DeviceContext** ppImmediateContext );
            );
        public static int D3D11CreateDeviceAndSwapChain(
            ref DXGI_SWAP_CHAIN_DESC pSwapChainDesc,
            out IDXGISwapChain ppSwapChain,
            out ID3D11Device ppDevice,
            out ID3D11DeviceContext ppImmediateContext,
            IDXGIAdapter pAdapter = null,
            D3D_DRIVER_TYPE DriverType = D3D_DRIVER_TYPE.D3D_DRIVER_TYPE_HARDWARE,
            IntPtr Software = default(IntPtr),
            D3D11_CREATE_DEVICE_FLAG Flags = 0,
            D3D_FEATURE_LEVEL[] pFeatureLevels = null,
            DX_SDK_VERSIONS SDKVersion = DX_SDK_VERSIONS.D3D11_SDK_VERSION
            )
        {
            LP_IDXGISwapChain ppSwapChain1 = new LP_IDXGISwapChain();
            LP_ID3D11Device ppDevice1 = new LP_ID3D11Device();
            LP_ID3D11DeviceContext ppImmediateContext1 = new LP_ID3D11DeviceContext();
            int rv = 0;
            unsafe
            {
                fixed (void* pSwapChainDesc1 = &pSwapChainDesc)
                {
                    rv = D3D11CreateDeviceAndSwapChain(pAdapter, DriverType, Software, Flags, pFeatureLevels, pFeatureLevels == null ? 0 : (uint)pFeatureLevels.Length, SDKVersion, new IntPtr(pSwapChainDesc1),
                        ppSwapChain: ppSwapChain1, ppDevice: ppDevice1, ppImmediateContext: ppImmediateContext1);
                }
            }
            ppSwapChain = ppSwapChain1.Value;
            ppDevice = ppDevice1.Value;
            ppImmediateContext = ppImmediateContext1.Value;
            return rv;
        }
        public static int D3D11CreateDeviceAndSwapChain(
            DXGI_SWAP_CHAIN_DESC pSwapChainDesc,
            out IDXGISwapChain ppSwapChain,
            out ID3D11Device ppDevice,
            out ID3D11DeviceContext ppImmediateContext,
            IDXGIAdapter pAdapter = null,
            D3D_DRIVER_TYPE DriverType = D3D_DRIVER_TYPE.D3D_DRIVER_TYPE_HARDWARE,
            IntPtr Software = default(IntPtr),
            D3D11_CREATE_DEVICE_FLAG Flags = 0,
            D3D_FEATURE_LEVEL[] pFeatureLevels = null,
            DX_SDK_VERSIONS SDKVersion = DX_SDK_VERSIONS.D3D11_SDK_VERSION
            )
        {
            return D3D11CreateDeviceAndSwapChain(ref pSwapChainDesc, out ppSwapChain, out ppDevice, out ppImmediateContext, pAdapter, DriverType, Software, Flags, pFeatureLevels, SDKVersion);
        }
        #endregion
        #endregion

        [DllImport("d3dx11_43.dll", EntryPoint = "D3DX11CompileFromFileW"), System.Security.SuppressUnmanagedCodeSecurity]
        internal static extern int D3DX11CompileFromFileW(
            [MarshalAs(UnmanagedType.LPWStr)] string fileName,
            [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStruct)] D3D_SHADER_MACRO[] pDefines,
            [MarshalAs(UnmanagedType.AsAny)] dynamic pInclude,
            [MarshalAs(UnmanagedType.LPStr)] string entryFunc,
            [MarshalAs(UnmanagedType.LPStr)] string profile,
            D3DCOMPILE_OPTIONS Flags1,
            uint Flags2,
            [MarshalAs(UnmanagedType.AsAny)] dynamic pPump,
            out ID3D10Blob pShader,
            out ID3D10Blob pErrorMsgs,
            [MarshalAs(UnmanagedType.AsAny)] dynamic pHResult
            );


        public static int SetDebugData_String(ID3D11DeviceChild pDevice, string data)
        {
            if (pDevice != null)
            {
                IntPtr pData = Marshal.StringToCoTaskMemAnsi(data);
                int nStringLen = ASCIIEncoding.ASCII.GetByteCount(data);
                pDevice.SetPrivateData(DX11_Guids_And_Consts.WKPDID_D3DDebugObjectName, (uint)nStringLen, pData);
                Marshal.FreeCoTaskMem(pData);
                return nStringLen;
            }
            return -1;
        }

        public static int CreateComputeDevice(out ID3D11Device pDevice, out ID3D11DeviceContext pImmediateContext, bool bForceRef = false, bool needDoublePrecision = false)
        {
            int hr = 0;
            pDevice = null;
            pImmediateContext = null;
            D3D11_CREATE_DEVICE_FLAG uCreationFlags = D3D11_CREATE_DEVICE_FLAG.D3D11_CREATE_DEVICE_SINGLETHREADED;
#if DEBUG
            uCreationFlags |= D3D11_CREATE_DEVICE_FLAG.D3D11_CREATE_DEVICE_DEBUG;
#endif
            D3D_FEATURE_LEVEL flOut = new D3D_FEATURE_LEVEL();
            D3D_FEATURE_LEVEL[] flvl = {
                D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_0,
                D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_10_1,
                D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_10_0 };
            bool bNeedRefDevice = false;
            if (!bForceRef)
            {
                try
                {
                    hr = D3D11CreateDevice(
                        null,
                        D3D_DRIVER_TYPE.D3D_DRIVER_TYPE_HARDWARE,
                        new IntPtr(0),
                        uCreationFlags,
                        flvl,
                        (uint)flvl.Length,
                        DX_SDK_VERSIONS.D3D11_SDK_VERSION,
                        out pDevice,
                        out flOut,
                        out pImmediateContext);
                }
                catch (DllNotFoundException)
                {
                    throw new NotSupportedException("您可能未安装 DirectX 11.");
                }
                if (hr >= 0)
                {
                    if (flOut < D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_0)
                    {
                        if (needDoublePrecision)
                        {
                            bNeedRefDevice = true;
                        }
                        else
                        {
                            D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS hwopts = new D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS();
                            pDevice.CheckFeatureSupport(out hwopts);
                            if (hwopts.ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x == 0)
                            {
                                bNeedRefDevice = true;
                            }
                        }
                    }
                    else
                    {
                        if (needDoublePrecision)
                        {
                            D3D11_FEATURE_DATA_DOUBLES hwopts = new D3D11_FEATURE_DATA_DOUBLES();
                            pDevice.CheckFeatureSupport(out hwopts);
                            if (hwopts.DoublePrecisionFloatShaderOps == 0)
                            {
                                bNeedRefDevice = true;
                            }
                        }
                    }
                }
            }

            if (bForceRef || hr < 0 || bNeedRefDevice)
            {
                pDevice = null;
                pImmediateContext = null;

                hr = D3D11CreateDevice(
                    null,
                    D3D_DRIVER_TYPE.D3D_DRIVER_TYPE_REFERENCE,
                    new IntPtr(0),
                    uCreationFlags,
                    flvl,
                    (uint)flvl.Length,
                    DX_SDK_VERSIONS.D3D11_SDK_VERSION,
                    out pDevice,
                    out flOut,
                    out pImmediateContext);

                if (hr < 0) throw new NotSupportedException("创建设备失败！");
                return 1;
            }

            return 0;
        }

        public static ID3D11ComputeShader CreateComputeShader(string fileName, string entryFunc, ID3D11Device pDevice, D3D_SHADER_MACRO[] defines = null)
        {
            if (!System.IO.File.Exists(fileName)) return null;
            D3DCOMPILE_OPTIONS dwShaderFlags = D3DCOMPILE_OPTIONS.D3DCOMPILE_ENABLE_STRICTNESS;
#if DEBUG
            dwShaderFlags |= D3DCOMPILE_OPTIONS.D3DCOMPILE_DEBUG;
#endif
            string profile = pDevice.GetFeatureLevel() >= D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_0 ? "cs_5_0" : "cs_4_0";
            ID3D10Blob pErrorBlob = null;
            ID3D10Blob pBlob = null;
            int hr = D3DX11CompileFromFileW(
                fileName,
                defines,
                null,
                entryFunc,
                profile,
                dwShaderFlags,
                0,
                null,
                out pBlob,
                out pErrorBlob,
                null);
            if (hr < 0) throw new FormatException(Marshal.PtrToStringAnsi(pErrorBlob.GetBufferPointer()));
            ID3D11ComputeShader pShaderOut = null;
            pDevice.CreateComputeShader(pBlob.GetBufferPointer(), pBlob.GetBufferSizeLong(), out pShaderOut);
#if DEBUG || PROFILE
            SetDebugData_String(pShaderOut, entryFunc);
#endif
            return pShaderOut;
        }

        public static ID3D11Buffer CreateStructuredBuffer(ID3D11Device pDevice, uint uElementSize, uint uCount, IntPtr pInitData, string debugDescString = "StructuredBuffer")
        {
            LP_ID3D11Buffer ppBufOut = new LP_ID3D11Buffer();
            D3D11_BUFFER_DESC desc = new D3D11_BUFFER_DESC();
            desc.BindFlags = D3D11_BIND_FLAG.D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_FLAG.D3D11_BIND_SHADER_RESOURCE;
            desc.ByteWidth = uElementSize * uCount;
            desc.MiscFlags = D3D11_RESOURCE_MISC_FLAG.D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
            desc.StructureByteStride = uElementSize;
            if (pInitData != IntPtr.Zero)
            {
                LP_D3D11_SUBRESOURCE_DATA pD3DInitData = new LP_D3D11_SUBRESOURCE_DATA();
                pD3DInitData.Value.pSysMem = pInitData;
                pDevice.CreateBuffer(desc, pD3DInitData, ppBufOut);
            }
            else
            {
                pDevice.CreateBuffer(desc, null, ppBufOut);
            }
            return ppBufOut.Value;
        }

        public static ID3D11Buffer CreateStructuredBuffer(ID3D11Device pDevice, uint uElementSize, uint uCount, dynamic arrInitData, string debugDescString = "StructuredBuffer")
        {
            if (arrInitData != null && !arrInitData.GetType().IsArray && !arrInitData.GetType().IsValueType) throw new ArgumentException("public static ID3D11Buffer CreateStructuredBuffer(ID3D11Device pDevice, uint uElementSize, uint uCount, dynamic arrInitData, string debugDescString)：arrInitData参数必须是数组/值类型。");
            LP_ID3D11Buffer ppBufOut = new LP_ID3D11Buffer();
            D3D11_BUFFER_DESC desc = new D3D11_BUFFER_DESC();
            desc.BindFlags = D3D11_BIND_FLAG.D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_FLAG.D3D11_BIND_SHADER_RESOURCE;
            desc.ByteWidth = uElementSize * uCount;
            desc.MiscFlags = D3D11_RESOURCE_MISC_FLAG.D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
            desc.StructureByteStride = uElementSize;
            if (arrInitData != null && arrInitData.GetType().IsArray)
            {
                LP_D3D11_SUBRESOURCE_DATA pD3DInitData = new LP_D3D11_SUBRESOURCE_DATA();
                pD3DInitData.Value.pSysMem = Marshal.AllocCoTaskMem(arrInitData.Length * Marshal.SizeOf(arrInitData.GetType().GetElementType()));
                Marshal.Copy(arrInitData, 0, pD3DInitData.Value.pSysMem, arrInitData.Length);
                pDevice.CreateBuffer(desc, pD3DInitData, ppBufOut);
                Marshal.FreeCoTaskMem(pD3DInitData.Value.pSysMem);
            }
            else if (arrInitData != null && arrInitData.GetType().IsValueType)
            {
                LP_D3D11_SUBRESOURCE_DATA pD3DInitData = new LP_D3D11_SUBRESOURCE_DATA();
                pD3DInitData.Value.pSysMem = Marshal.AllocCoTaskMem(Marshal.SizeOf(arrInitData.GetType()));
                Marshal.StructureToPtr(arrInitData, pD3DInitData.Value.pSysMem, false);
                pDevice.CreateBuffer(desc, pD3DInitData, ppBufOut);
                Marshal.FreeCoTaskMem(pD3DInitData.Value.pSysMem);
            }
            else
            {
                pDevice.CreateBuffer(desc, null, ppBufOut);
            }
            return ppBufOut.Value;
        }

        public static ID3D11Buffer CreateRawBuffer(ID3D11Device pDevice, uint uSize, IntPtr pInitData, string debugDescString = "RawBuffer")
        {
            LP_ID3D11Buffer ppBufOut = new LP_ID3D11Buffer();
            D3D11_BUFFER_DESC desc = new D3D11_BUFFER_DESC();
            desc.BindFlags = D3D11_BIND_FLAG.D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_FLAG.D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_FLAG.D3D11_BIND_INDEX_BUFFER | D3D11_BIND_FLAG.D3D11_BIND_VERTEX_BUFFER;
            desc.ByteWidth = uSize;
            desc.MiscFlags = D3D11_RESOURCE_MISC_FLAG.D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS;
            if (pInitData != IntPtr.Zero)
            {
                LP_D3D11_SUBRESOURCE_DATA pD3DInitData = new LP_D3D11_SUBRESOURCE_DATA();
                pD3DInitData.Value.pSysMem = pInitData;
                pDevice.CreateBuffer(desc, pD3DInitData, ppBufOut);
            }
            else
            {
                pDevice.CreateBuffer(desc, null, ppBufOut);
            }
            return ppBufOut.Value;
        }

        public static ID3D11Buffer CreateRawBuffer(ID3D11Device pDevice, uint uSize, dynamic arrInitData, string debugDescString = "RawBuffer")
        {
            if (arrInitData != null && !arrInitData.GetType().IsArray) throw new ArgumentException("public static ID3D11Buffer CreateStructuredBuffer(ID3D11Device pDevice, uint uElementSize, uint uCount, dynamic arrInitData, string debugDescString)：arrInitData参数必须是数组。");
            LP_ID3D11Buffer ppBufOut = new LP_ID3D11Buffer();
            D3D11_BUFFER_DESC desc = new D3D11_BUFFER_DESC();
            desc.BindFlags = D3D11_BIND_FLAG.D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_FLAG.D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_FLAG.D3D11_BIND_INDEX_BUFFER | D3D11_BIND_FLAG.D3D11_BIND_VERTEX_BUFFER;
            desc.ByteWidth = uSize;
            desc.MiscFlags = D3D11_RESOURCE_MISC_FLAG.D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS;
            if (arrInitData != null)
            {
                LP_D3D11_SUBRESOURCE_DATA pD3DInitData = new LP_D3D11_SUBRESOURCE_DATA();
                pD3DInitData.Value.pSysMem = Marshal.AllocCoTaskMem(arrInitData.Length * Marshal.SizeOf(arrInitData.GetType().GetElementType()));
                Marshal.Copy(arrInitData, 0, pD3DInitData.Value.pSysMem, arrInitData.Length);
                pDevice.CreateBuffer(desc, pD3DInitData, ppBufOut);
                Marshal.FreeCoTaskMem(pD3DInitData.Value.pSysMem);
            }
            else
            {
                pDevice.CreateBuffer(desc, null, ppBufOut);
            }
            return ppBufOut.Value;
        }

        public static ID3D11Buffer CreateConstBuffer(ID3D11Device pDevice, uint uSize, IntPtr pInitData, string debugDescString = "ConstBuffer")
        {
            LP_ID3D11Buffer ppBufOut = new LP_ID3D11Buffer();
            D3D11_BUFFER_DESC desc = new D3D11_BUFFER_DESC();
            desc.BindFlags = D3D11_BIND_FLAG.D3D11_BIND_CONSTANT_BUFFER;
            desc.ByteWidth = (uSize + 15) / 16 * 16;
            if (pInitData != IntPtr.Zero)
            {
                LP_D3D11_SUBRESOURCE_DATA pD3DInitData = new LP_D3D11_SUBRESOURCE_DATA();
                pD3DInitData.Value.pSysMem = pInitData;
                pDevice.CreateBuffer(desc, pD3DInitData, ppBufOut);
            }
            else
            {
                pDevice.CreateBuffer(desc, null, ppBufOut);
            }
            return ppBufOut.Value;
        }

        public static ID3D11Buffer CreateConstBuffer(ID3D11Device pDevice, uint uSize, dynamic arrInitData, string debugDescString = "ConstBuffer")
        {
            if (arrInitData != null && !arrInitData.GetType().IsArray && !arrInitData.GetType().IsValueType) throw new ArgumentException("public static ID3D11Buffer CreateStructuredBuffer(ID3D11Device pDevice, uint uElementSize, uint uCount, dynamic arrInitData, string debugDescString)：arrInitData参数必须是数组/值类型。");
            LP_ID3D11Buffer ppBufOut = new LP_ID3D11Buffer();
            D3D11_BUFFER_DESC desc = new D3D11_BUFFER_DESC();
            desc.ByteWidth = (uSize + 15) / 16 * 16;
            desc.BindFlags = D3D11_BIND_FLAG.D3D11_BIND_CONSTANT_BUFFER;
            if (arrInitData != null && arrInitData.GetType().IsArray)
            {
                LP_D3D11_SUBRESOURCE_DATA pD3DInitData = new LP_D3D11_SUBRESOURCE_DATA();
                pD3DInitData.Value.pSysMem = Marshal.AllocCoTaskMem(arrInitData.Length * Marshal.SizeOf(arrInitData.GetType().GetElementType()));
                Marshal.Copy(arrInitData, 0, pD3DInitData.Value.pSysMem, arrInitData.Length);
                pDevice.CreateBuffer(desc, pD3DInitData, ppBufOut);
                Marshal.FreeCoTaskMem(pD3DInitData.Value.pSysMem);
            }
            else if (arrInitData != null && arrInitData.GetType().IsValueType)
            {
                LP_D3D11_SUBRESOURCE_DATA pD3DInitData = new LP_D3D11_SUBRESOURCE_DATA();
                pD3DInitData.Value.pSysMem = Marshal.AllocCoTaskMem(Marshal.SizeOf(arrInitData.GetType()));
                Marshal.StructureToPtr(arrInitData, pD3DInitData.Value.pSysMem, false);
                pDevice.CreateBuffer(desc, pD3DInitData, ppBufOut);
                Marshal.FreeCoTaskMem(pD3DInitData.Value.pSysMem);
            }
            else
            {
                pDevice.CreateBuffer(desc, null, ppBufOut);
            }
            return ppBufOut.Value;
        }

        public static ID3D11ShaderResourceView CreateBufferSRV(ID3D11Device pDevice, ID3D11Buffer pBuffer, string debugDescString = "Shader Resource View")
        {
            LP_ID3D11ShaderResourceView pSRVOut = new LP_ID3D11ShaderResourceView();
            D3D11_BUFFER_DESC descBuf;
            pBuffer.GetDesc(out descBuf);
            LP_D3D11_SHADER_RESOURCE_VIEW_DESC desc = new LP_D3D11_SHADER_RESOURCE_VIEW_DESC();
            desc.Value.ViewDimension = D3D_SRV_DIMENSION.D3D_SRV_DIMENSION_BUFFEREX;
            D3D11_BUFFEREX_SRV bufferEx = new D3D11_BUFFEREX_SRV();
            bufferEx.FirstElement = 0;

            if ((descBuf.MiscFlags & D3D11_RESOURCE_MISC_FLAG.D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS) != 0)
            {
                // RawBuffer
                desc.Value.Format = DXGI_FORMAT.DXGI_FORMAT_R32_TYPELESS;
                bufferEx.Flags = D3D11_BUFFEREX_SRV_FLAG.D3D11_BUFFEREX_SRV_FLAG_RAW;
                bufferEx.NumElements = descBuf.ByteWidth / 4;
            }
            else if ((descBuf.MiscFlags & D3D11_RESOURCE_MISC_FLAG.D3D11_RESOURCE_MISC_BUFFER_STRUCTURED) != 0)
            {
                // Structed Buffer
                desc.Value.Format = DXGI_FORMAT.DXGI_FORMAT_UNKNOWN;
                bufferEx.NumElements = descBuf.ByteWidth / descBuf.StructureByteStride;
            }
            else throw new FormatException("Buffer类型既不是Raw Buffer又不是Structed Buffer.");
            desc.Value.BufferEx = bufferEx;
            pDevice.CreateShaderResourceView((ID3D11Resource)pBuffer, desc, pSRVOut);
#if DEBUG || PROFILE
            SetDebugData_String(pSRVOut.Value, debugDescString);
#endif
            return pSRVOut.Value;
        }

        public static ID3D11UnorderedAccessView CreateBufferUAV(ID3D11Device pDevice, ID3D11Buffer pBuffer, string debugDescString = "Unordered Accesss View")
        {
            LP_ID3D11UnorderedAccessView pUAVOut = new LP_ID3D11UnorderedAccessView();
            D3D11_BUFFER_DESC descBuf;
            pBuffer.GetDesc(out descBuf);
            LP_D3D11_UNORDERED_ACCESS_VIEW_DESC desc = new LP_D3D11_UNORDERED_ACCESS_VIEW_DESC();
            desc.Value.ViewDimension = D3D11_UAV_DIMENSION.D3D11_UAV_DIMENSION_BUFFER;
            D3D11_BUFFER_UAV bufferDesc = new D3D11_BUFFER_UAV();
            bufferDesc.FirstElement = 0;

            if ((descBuf.MiscFlags & D3D11_RESOURCE_MISC_FLAG.D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS) != 0)
            {
                // RawBuffer
                desc.Value.Format = DXGI_FORMAT.DXGI_FORMAT_R32_TYPELESS;
                bufferDesc.Flags = D3D11_BUFFER_UAV_FLAG.D3D11_BUFFER_UAV_FLAG_RAW;
                bufferDesc.NumElements = descBuf.ByteWidth / 4;
            }
            else if ((descBuf.MiscFlags & D3D11_RESOURCE_MISC_FLAG.D3D11_RESOURCE_MISC_BUFFER_STRUCTURED) != 0)
            {
                // Structed Buffer
                desc.Value.Format = DXGI_FORMAT.DXGI_FORMAT_UNKNOWN;
                bufferDesc.NumElements = descBuf.ByteWidth / descBuf.StructureByteStride;
            }
            else throw new FormatException("Buffer类型既不是Raw Buffer又不是Structed Buffer.");
            desc.Value.Buffer = bufferDesc;
            pDevice.CreateUnorderedAccessView((ID3D11Resource)pBuffer, desc, pUAVOut);
#if DEBUG || PROFILE
            SetDebugData_String(pUAVOut.Value, debugDescString);
#endif
            return pUAVOut.Value;
        }

        public static void BuildComputePipeline(
            ID3D11Device pDevice,
            ID3D11DeviceContext pd3dImmediateContext,
            ID3D11ComputeShader pComputeShader,
            ID3D11ShaderResourceView[] ppShaderResourceViews,
            ID3D11UnorderedAccessView[] ppUnorderedAccessViews,
            ID3D11Buffer[] ppConstantBuffers = null
            )
        {
            if (pDevice.GetFeatureLevel() < D3D_FEATURE_LEVEL.D3D_FEATURE_LEVEL_11_0 && ppUnorderedAccessViews.Length > 1)
                throw new NotSupportedException("您的设备不支持DirectX 11，因此只能使用一个Unordered Access View。");
            pd3dImmediateContext.CSSetShader(pComputeShader, null, 0);
            pd3dImmediateContext.CSSetShaderResources(0, (uint)ppShaderResourceViews.Length, ppShaderResourceViews);
            pd3dImmediateContext.CSSetUnorderedAccessViews(0, (uint)ppUnorderedAccessViews.Length, ppUnorderedAccessViews, null);
            if (ppConstantBuffers != null) pd3dImmediateContext.CSSetConstantBuffers(0, (uint)ppConstantBuffers.Length, ppConstantBuffers);
        }

        public static void CleanUpComputePipeline(ID3D11DeviceContext pd3dImmediateContext)
        {
            pd3dImmediateContext.CSSetShader(null, null, 0);
            pd3dImmediateContext.CSSetUnorderedAccessViews(0, DX11_Guids_And_Consts.D3D11_PS_CS_UAV_REGISTER_COUNT, new ID3D11UnorderedAccessView[DX11_Guids_And_Consts.D3D11_PS_CS_UAV_REGISTER_COUNT], null);
            pd3dImmediateContext.CSSetShaderResources(0, DX11_Guids_And_Consts.D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, new ID3D11ShaderResourceView[DX11_Guids_And_Consts.D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT]);
            pd3dImmediateContext.CSSetConstantBuffers(0, DX11_Guids_And_Consts.D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, new ID3D11Buffer[DX11_Guids_And_Consts.D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT]);
        }

        public static byte[] CopyResultToSysMem(ID3D11Device pDevice, ID3D11DeviceContext pd3dImmediateContext, ID3D11Buffer pGpuBuffer)
        {
            D3D11_BUFFER_DESC desc;
            pGpuBuffer.GetDesc(out desc);
            if (desc.ByteWidth == 0) return null;
            desc.CPUAccessFlags = D3D11_CPU_ACCESS_FLAG.D3D11_CPU_ACCESS_READ;
            desc.Usage = D3D11_USAGE.D3D11_USAGE_STAGING;
            desc.BindFlags = 0;
            desc.MiscFlags = 0;
            LP_ID3D11Buffer pdebugbuf = new LP_ID3D11Buffer();
            pDevice.CreateBuffer(desc, null, pdebugbuf);
            ID3D11Buffer debugbuf = pdebugbuf.Value;
            pd3dImmediateContext.CopyResource((ID3D11Resource)debugbuf, (ID3D11Resource)pGpuBuffer);
            D3D11_MAPPED_SUBRESOURCE MappedResource;
            pd3dImmediateContext.Map((ID3D11Resource)debugbuf, 0, D3D11_MAP.D3D11_MAP_READ, 0, out MappedResource);
            byte[] value = new byte[desc.ByteWidth];
            Marshal.Copy(MappedResource.pData, value, 0, (int)desc.ByteWidth);
            pd3dImmediateContext.Unmap((ID3D11Resource)debugbuf, 0);
            return value;
        }

        /// <summary>
        /// 拷贝显存数据到系统内存。
        /// </summary>
        /// <param name="pDevice"></param>
        /// <param name="pd3dImmediateContext"></param>
        /// <param name="pGpuBuffer"></param>
        /// <param name="pDest">目标内存区。
        /// <remarks>应事先分配该内存，并自行管理。传入null以确定要分配的内存大小（通过返回值）。</remarks>
        /// </param>
        /// <returns>数据数量（以字节为单位）。</returns>
        public static uint CopyResultToSysMem(ID3D11Device pDevice, ID3D11DeviceContext pd3dImmediateContext, ID3D11Buffer pGpuBuffer, IntPtr pDest)
        {
            D3D11_BUFFER_DESC desc;
            pGpuBuffer.GetDesc(out desc);
            if (pDest == null) return desc.ByteWidth;
            if (desc.ByteWidth == 0) return 0;
            desc.CPUAccessFlags = D3D11_CPU_ACCESS_FLAG.D3D11_CPU_ACCESS_READ;
            desc.Usage = D3D11_USAGE.D3D11_USAGE_STAGING;
            desc.BindFlags = 0;
            desc.MiscFlags = 0;
            LP_ID3D11Buffer pdebugbuf = new LP_ID3D11Buffer();
            pDevice.CreateBuffer(desc, ppBuffer: pdebugbuf);
            ID3D11Buffer debugbuf = pdebugbuf.Value;
            pd3dImmediateContext.CopyResource((ID3D11Resource)debugbuf, (ID3D11Resource)pGpuBuffer);
            D3D11_MAPPED_SUBRESOURCE MappedResource;
            pd3dImmediateContext.Map((ID3D11Resource)debugbuf, 0, D3D11_MAP.D3D11_MAP_READ, 0, out MappedResource);
            CopyMemory(pDest, MappedResource.pData, desc.ByteWidth);
            pd3dImmediateContext.Unmap((ID3D11Resource)debugbuf, 0);
            return desc.ByteWidth;
        }

        public static uint CopyResultToSysMem(ID3D11Device pDevice, ID3D11DeviceContext pd3dImmediateContext, ID3D11Buffer pGpuBuffer, dynamic pDest)
        {
            if (pDest == null || !pDest.GetType().IsArray) throw new ArgumentException("public static uint CopyResultToSysMem(ID3D11Device pDevice, ID3D11DeviceContext pd3dImmediateContext, ID3D11Buffer pGpuBuffer, dynamic pDest)：参数pDest必须是一数组。");
            D3D11_BUFFER_DESC desc;
            pGpuBuffer.GetDesc(out desc);
            if (pDest == null) return desc.ByteWidth;
            if (desc.ByteWidth == 0) return 0;
            desc.CPUAccessFlags = D3D11_CPU_ACCESS_FLAG.D3D11_CPU_ACCESS_READ;
            desc.Usage = D3D11_USAGE.D3D11_USAGE_STAGING;
            desc.BindFlags = 0;
            desc.MiscFlags = 0;
            LP_ID3D11Buffer pdebugbuf = new LP_ID3D11Buffer();
            pDevice.CreateBuffer(desc, ppBuffer: pdebugbuf);
            ID3D11Buffer debugbuf = pdebugbuf.Value;
            pd3dImmediateContext.CopyResource((ID3D11Resource)debugbuf, (ID3D11Resource)pGpuBuffer);
            D3D11_MAPPED_SUBRESOURCE MappedResource;
            pd3dImmediateContext.Map((ID3D11Resource)debugbuf, 0, D3D11_MAP.D3D11_MAP_READ, 0, out MappedResource);
            Marshal.Copy(MappedResource.pData, pDest, 0, pDest.Length);
            pd3dImmediateContext.Unmap((ID3D11Resource)debugbuf, 0);
            return desc.ByteWidth;
        }

        public static IntPtr CreateAndCopyResultToSysMem(ID3D11Device pDevice, ID3D11DeviceContext pd3dImmediateContext, ID3D11Buffer pGpuBuffer)
        {
            D3D11_BUFFER_DESC desc;
            pGpuBuffer.GetDesc(out desc);
            if (desc.ByteWidth == 0) return IntPtr.Zero;
            desc.CPUAccessFlags = D3D11_CPU_ACCESS_FLAG.D3D11_CPU_ACCESS_READ;
            desc.Usage = D3D11_USAGE.D3D11_USAGE_STAGING;
            desc.BindFlags = 0;
            desc.MiscFlags = 0;
            LP_ID3D11Buffer pdebugbuf = new LP_ID3D11Buffer();
            pDevice.CreateBuffer(desc, ppBuffer: pdebugbuf);
            ID3D11Buffer debugbuf = pdebugbuf.Value;
            pd3dImmediateContext.CopyResource((ID3D11Resource)debugbuf, (ID3D11Resource)pGpuBuffer);
            D3D11_MAPPED_SUBRESOURCE MappedResource;
            IntPtr pData = Marshal.AllocCoTaskMem((int)desc.ByteWidth);
            pd3dImmediateContext.Map((ID3D11Resource)debugbuf, 0, D3D11_MAP.D3D11_MAP_READ, 0, out MappedResource);
            CopyMemory(pData, MappedResource.pData, desc.ByteWidth);
            pd3dImmediateContext.Unmap((ID3D11Resource)debugbuf, 0);
            return pData;
        }

        public static void UpdateData(ID3D11DeviceContext pd3dImmediateContext, ID3D11Resource pDstResource, dynamic data)
        {
            if (data == null) return;
            Type dataType = data.GetType();
            if (!dataType.IsArray) throw new ArgumentException("public static void UpdateData(ID3D11DeviceContext pd3dImmediateContext, ID3D11Resource pDstResource, dynamic data)：该方法的data参数应当是一个数组。");
            IntPtr pData = Marshal.AllocCoTaskMem(data.Length * Marshal.SizeOf(dataType.GetElementType()));
            Marshal.Copy(data, 0, pData, data.Length);
            pd3dImmediateContext.UpdateSubresource(pDstResource, 0, IntPtr.Zero, pData, 0, 0);
            Marshal.FreeCoTaskMem(pData);
        }
    }

    #region Enums
    #region Legacy
    #region DX9
    public enum D3DSWAPEFFECT : uint
    { 
        D3DSWAPEFFECT_DISCARD       = 1,
        D3DSWAPEFFECT_FLIP          = 2,
        D3DSWAPEFFECT_COPY          = 3,
        D3DSWAPEFFECT_OVERLAY       = 4,
        D3DSWAPEFFECT_FLIPEX        = 5,
        D3DSWAPEFFECT_FORCE_DWORD   = 0xFFFFFFFF 
    }
    [Flags]
    public enum D3DPRESENT : uint
    {
        D3DPRESENT_DONOTWAIT                    = 0x00000001U,
        D3DPRESENT_LINEAR_CONTENT               = 0x00000002U,

        D3DPRESENT_DONOTFLIP                    = 0x00000004U,
        D3DPRESENT_FLIPRESTART                  = 0x00000008U,
        D3DPRESENT_VIDEO_RESTRICT_TO_MONITOR    = 0x00000010U,
        D3DPRESENT_UPDATEOVERLAYONLY            = 0x00000020U,
        D3DPRESENT_HIDEOVERLAY                  = 0x00000040U,
        D3DPRESENT_UPDATECOLORKEY               = 0x00000080U,
        D3DPRESENT_FORCEIMMEDIATE               = 0x00000100U,

        D3DPRESENT_INTERVAL_DEFAULT             = 0x00000000U,
        D3DPRESENT_INTERVAL_ONE                 = 0x00000001U,
        D3DPRESENT_INTERVAL_TWO                 = 0x00000002U,
        D3DPRESENT_INTERVAL_THREE               = 0x00000004U,
        D3DPRESENT_INTERVAL_FOUR                = 0x00000008U,
        D3DPRESENT_INTERVAL_IMMEDIATE           = 0x80000000U,
    }
    public enum D3DDEVTYPE : uint
    {
        D3DDEVTYPE_HAL = 1,
        D3DDEVTYPE_NULLREF = 4,
        D3DDEVTYPE_REF = 2,
        D3DDEVTYPE_SW = 3,
        D3DDEVTYPE_FORCE_DWORD = 0xffffffff
    }
    [Flags]
    public enum D3DCREATE : uint
    {
        D3DCREATE_FPU_PRESERVE                 = 0x00000002U,
        D3DCREATE_MULTITHREADED                = 0x00000004U,

        D3DCREATE_PUREDEVICE                   = 0x00000010U,
        D3DCREATE_SOFTWARE_VERTEXPROCESSING    = 0x00000020U,
        D3DCREATE_HARDWARE_VERTEXPROCESSING    = 0x00000040U,
        D3DCREATE_MIXED_VERTEXPROCESSING       = 0x00000080U,

        D3DCREATE_DISABLE_DRIVER_MANAGEMENT    = 0x00000100U,
        D3DCREATE_ADAPTERGROUP_DEVICE          = 0x00000200U,
        D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX = 0x00000400U,

        D3DCREATE_NOWINDOWCHANGES			   = 0x00000800U,

        D3DCREATE_DISABLE_PSGP_THREADING       = 0x00002000U,

        D3DCREATE_ENABLE_PRESENTSTATS          = 0x00004000U,

        D3DCREATE_DISABLE_PRINTSCREEN          = 0x00008000U,

        D3DCREATE_SCREENSAVER                  = 0x10000000U,
    }
    public enum D3DFORMAT : uint
    {
        D3DFMT_UNKNOWN              =  0,

        D3DFMT_R8G8B8               = 20,
        D3DFMT_A8R8G8B8             = 21,
        D3DFMT_X8R8G8B8             = 22,
        D3DFMT_R5G6B5               = 23,
        D3DFMT_X1R5G5B5             = 24,
        D3DFMT_A1R5G5B5             = 25,
        D3DFMT_A4R4G4B4             = 26,
        D3DFMT_R3G3B2               = 27,
        D3DFMT_A8                   = 28,
        D3DFMT_A8R3G3B2             = 29,
        D3DFMT_X4R4G4B4             = 30,
        D3DFMT_A2B10G10R10          = 31,
        D3DFMT_A8B8G8R8             = 32,
        D3DFMT_X8B8G8R8             = 33,
        D3DFMT_G16R16               = 34,
        D3DFMT_A2R10G10B10          = 35,
        D3DFMT_A16B16G16R16         = 36,

        D3DFMT_A8P8                 = 40,
        D3DFMT_P8                   = 41,

        D3DFMT_L8                   = 50,
        D3DFMT_A8L8                 = 51,
        D3DFMT_A4L4                 = 52,

        D3DFMT_V8U8                 = 60,
        D3DFMT_L6V5U5               = 61,
        D3DFMT_X8L8V8U8             = 62,
        D3DFMT_Q8W8V8U8             = 63,
        D3DFMT_V16U16               = 64,
        D3DFMT_A2W10V10U10          = 67,

        D3DFMT_UYVY                 = ((uint)'U') + (((uint)'Y') << 8) + (((uint)'V') << 16) + (((uint)'Y') << 24),
        D3DFMT_R8G8_B8G8            = ((uint)'R') + (((uint)'G') << 8) + (((uint)'B') << 16) + (((uint)'G') << 24),
        D3DFMT_YUY2                 = ((uint)'Y') + (((uint)'U') << 8) + (((uint)'Y') << 16) + (((uint)'2') << 24),
        D3DFMT_G8R8_G8B8            = ((uint)'G') + (((uint)'R') << 8) + (((uint)'G') << 16) + (((uint)'B') << 24),
        D3DFMT_DXT1                 = ((uint)'D') + (((uint)'X') << 8) + (((uint)'T') << 16) + (((uint)'1') << 24),
        D3DFMT_DXT2                 = ((uint)'D') + (((uint)'X') << 8) + (((uint)'T') << 16) + (((uint)'2') << 24),
        D3DFMT_DXT3                 = ((uint)'D') + (((uint)'X') << 8) + (((uint)'T') << 16) + (((uint)'3') << 24),
        D3DFMT_DXT4                 = ((uint)'D') + (((uint)'X') << 8) + (((uint)'T') << 16) + (((uint)'4') << 24),
        D3DFMT_DXT5                 = ((uint)'D') + (((uint)'X') << 8) + (((uint)'T') << 16) + (((uint)'5') << 24),

        D3DFMT_D16_LOCKABLE         = 70,
        D3DFMT_D32                  = 71,
        D3DFMT_D15S1                = 73,
        D3DFMT_D24S8                = 75,
        D3DFMT_D24X8                = 77,
        D3DFMT_D24X4S4              = 79,
        D3DFMT_D16                  = 80,

        D3DFMT_D32F_LOCKABLE        = 82,
        D3DFMT_D24FS8               = 83,

        /* D3D9Ex only -- */
        /* Z-Stencil formats valid for CPU access */
        D3DFMT_D32_LOCKABLE         = 84,
        D3DFMT_S8_LOCKABLE          = 85,
        /* -- D3D9Ex only */


        D3DFMT_L16                  = 81,

        D3DFMT_VERTEXDATA           =100,
        D3DFMT_INDEX16              =101,
        D3DFMT_INDEX32              =102,

        D3DFMT_Q16W16V16U16         =110,

        D3DFMT_MULTI2_ARGB8         = ((uint)'M') + (((uint)'E') << 8) + (((uint)'T') << 16) + (((uint)'1') << 24),

        // Floating point surface formats

        // s10e5 formats (16-bits per channel)
        D3DFMT_R16F                 = 111,
        D3DFMT_G16R16F              = 112,
        D3DFMT_A16B16G16R16F        = 113,

        // IEEE s23e8 formats (32-bits per channel)
        D3DFMT_R32F                 = 114,
        D3DFMT_G32R32F              = 115,
        D3DFMT_A32B32G32R32F        = 116,

        D3DFMT_CxV8U8               = 117,

        /* D3D9Ex only -- */
        // Monochrome 1 bit per pixel format
        D3DFMT_A1                   = 118,

        // 2.8 biased fixed point
        D3DFMT_A2B10G10R10_XR_BIAS  = 119,


        // Binary format indicating that the data has no inherent type
        D3DFMT_BINARYBUFFER         = 199,
        /* -- D3D9Ex only */


        D3DFMT_FORCE_DWORD          =0x7fffffff
    }
    public enum D3DSCANLINEORDERING : uint
    {
        D3DSCANLINEORDERING_PROGRESSIVE = 1,
        D3DSCANLINEORDERING_INTERLACED = 2
    }
    [Flags]
    public enum D3DUSAGE_QUERY : uint
    {
        D3DUSAGE_QUERY_LEGACYBUMPMAP            = (0x00008000U),
        D3DUSAGE_QUERY_SRGBREAD                 = (0x00010000U),
        D3DUSAGE_QUERY_FILTER                   = (0x00020000U),
        D3DUSAGE_QUERY_SRGBWRITE                = (0x00040000U),
        D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING = (0x00080000U),
        D3DUSAGE_QUERY_VERTEXTEXTURE            = (0x00100000U),
        D3DUSAGE_QUERY_WRAPANDMIP	            = (0x00200000U),
    }
    [Flags]
    public enum D3DUSAGE : uint
    {
        D3DUSAGE_RENDERTARGET       = (0x00000001U),
        D3DUSAGE_DEPTHSTENCIL       = (0x00000002U),
        D3DUSAGE_DYNAMIC            = (0x00000200U),
        D3DUSAGE_NONSECURE          = (0x00800000U),
        D3DUSAGE_AUTOGENMIPMAP      = (0x00000400U),
        D3DUSAGE_DMAP               = (0x00004000U),
        D3DUSAGE_WRITEONLY          = (0x00000008U),
        D3DUSAGE_SOFTWAREPROCESSING = (0x00000010U),
        D3DUSAGE_DONOTCLIP          = (0x00000020U),
        D3DUSAGE_POINTS             = (0x00000040U),
        D3DUSAGE_RTPATCHES          = (0x00000080U),
        D3DUSAGE_NPATCHES           = (0x00000100U),

        D3DUSAGE_TEXTAPI                         = (0x10000000U),
        D3DUSAGE_RESTRICTED_CONTENT              = (0x00000800U),
        D3DUSAGE_RESTRICT_SHARED_RESOURCE        = (0x00002000U),
        D3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER = (0x00001000U),
    }
    public enum D3DPOOL : uint
    {
        D3DPOOL_DEFAULT = 0,
        D3DPOOL_MANAGED = 1,
        D3DPOOL_SYSTEMMEM = 2,
        D3DPOOL_SCRATCH = 3,
        D3DPOOL_FORCE_DWORD = 0x7fffffff
    }
    #endregion
    #endregion

    #region DXGI
    public enum DXGI_FORMAT : uint
    {
        DXGI_FORMAT_UNKNOWN = 0,
        DXGI_FORMAT_R32G32B32A32_TYPELESS = 1,
        DXGI_FORMAT_R32G32B32A32_FLOAT = 2,
        DXGI_FORMAT_R32G32B32A32_UINT = 3,
        DXGI_FORMAT_R32G32B32A32_SINT = 4,
        DXGI_FORMAT_R32G32B32_TYPELESS = 5,
        DXGI_FORMAT_R32G32B32_FLOAT = 6,
        DXGI_FORMAT_R32G32B32_UINT = 7,
        DXGI_FORMAT_R32G32B32_SINT = 8,
        DXGI_FORMAT_R16G16B16A16_TYPELESS = 9,
        DXGI_FORMAT_R16G16B16A16_FLOAT = 10,
        DXGI_FORMAT_R16G16B16A16_UNORM = 11,
        DXGI_FORMAT_R16G16B16A16_UINT = 12,
        DXGI_FORMAT_R16G16B16A16_SNORM = 13,
        DXGI_FORMAT_R16G16B16A16_SINT = 14,
        DXGI_FORMAT_R32G32_TYPELESS = 15,
        DXGI_FORMAT_R32G32_FLOAT = 16,
        DXGI_FORMAT_R32G32_UINT = 17,
        DXGI_FORMAT_R32G32_SINT = 18,
        DXGI_FORMAT_R32G8X24_TYPELESS = 19,
        DXGI_FORMAT_D32_FLOAT_S8X24_UINT = 20,
        DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS = 21,
        DXGI_FORMAT_X32_TYPELESS_G8X24_UINT = 22,
        DXGI_FORMAT_R10G10B10A2_TYPELESS = 23,
        DXGI_FORMAT_R10G10B10A2_UNORM = 24,
        DXGI_FORMAT_R10G10B10A2_UINT = 25,
        DXGI_FORMAT_R11G11B10_FLOAT = 26,
        DXGI_FORMAT_R8G8B8A8_TYPELESS = 27,
        DXGI_FORMAT_R8G8B8A8_UNORM = 28,
        DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29,
        DXGI_FORMAT_R8G8B8A8_UINT = 30,
        DXGI_FORMAT_R8G8B8A8_SNORM = 31,
        DXGI_FORMAT_R8G8B8A8_SINT = 32,
        DXGI_FORMAT_R16G16_TYPELESS = 33,
        DXGI_FORMAT_R16G16_FLOAT = 34,
        DXGI_FORMAT_R16G16_UNORM = 35,
        DXGI_FORMAT_R16G16_UINT = 36,
        DXGI_FORMAT_R16G16_SNORM = 37,
        DXGI_FORMAT_R16G16_SINT = 38,
        DXGI_FORMAT_R32_TYPELESS = 39,
        DXGI_FORMAT_D32_FLOAT = 40,
        DXGI_FORMAT_R32_FLOAT = 41,
        DXGI_FORMAT_R32_UINT = 42,
        DXGI_FORMAT_R32_SINT = 43,
        DXGI_FORMAT_R24G8_TYPELESS = 44,
        DXGI_FORMAT_D24_UNORM_S8_UINT = 45,
        DXGI_FORMAT_R24_UNORM_X8_TYPELESS = 46,
        DXGI_FORMAT_X24_TYPELESS_G8_UINT = 47,
        DXGI_FORMAT_R8G8_TYPELESS = 48,
        DXGI_FORMAT_R8G8_UNORM = 49,
        DXGI_FORMAT_R8G8_UINT = 50,
        DXGI_FORMAT_R8G8_SNORM = 51,
        DXGI_FORMAT_R8G8_SINT = 52,
        DXGI_FORMAT_R16_TYPELESS = 53,
        DXGI_FORMAT_R16_FLOAT = 54,
        DXGI_FORMAT_D16_UNORM = 55,
        DXGI_FORMAT_R16_UNORM = 56,
        DXGI_FORMAT_R16_UINT = 57,
        DXGI_FORMAT_R16_SNORM = 58,
        DXGI_FORMAT_R16_SINT = 59,
        DXGI_FORMAT_R8_TYPELESS = 60,
        DXGI_FORMAT_R8_UNORM = 61,
        DXGI_FORMAT_R8_UINT = 62,
        DXGI_FORMAT_R8_SNORM = 63,
        DXGI_FORMAT_R8_SINT = 64,
        DXGI_FORMAT_A8_UNORM = 65,
        DXGI_FORMAT_R1_UNORM = 66,
        DXGI_FORMAT_R9G9B9E5_SHAREDEXP = 67,
        DXGI_FORMAT_R8G8_B8G8_UNORM = 68,
        DXGI_FORMAT_G8R8_G8B8_UNORM = 69,
        DXGI_FORMAT_BC1_TYPELESS = 70,
        DXGI_FORMAT_BC1_UNORM = 71,
        DXGI_FORMAT_BC1_UNORM_SRGB = 72,
        DXGI_FORMAT_BC2_TYPELESS = 73,
        DXGI_FORMAT_BC2_UNORM = 74,
        DXGI_FORMAT_BC2_UNORM_SRGB = 75,
        DXGI_FORMAT_BC3_TYPELESS = 76,
        DXGI_FORMAT_BC3_UNORM = 77,
        DXGI_FORMAT_BC3_UNORM_SRGB = 78,
        DXGI_FORMAT_BC4_TYPELESS = 79,
        DXGI_FORMAT_BC4_UNORM = 80,
        DXGI_FORMAT_BC4_SNORM = 81,
        DXGI_FORMAT_BC5_TYPELESS = 82,
        DXGI_FORMAT_BC5_UNORM = 83,
        DXGI_FORMAT_BC5_SNORM = 84,
        DXGI_FORMAT_B5G6R5_UNORM = 85,
        DXGI_FORMAT_B5G5R5A1_UNORM = 86,
        DXGI_FORMAT_B8G8R8A8_UNORM = 87,
        DXGI_FORMAT_B8G8R8X8_UNORM = 88,
        DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
        DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
        DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
        DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
        DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
        DXGI_FORMAT_BC6H_TYPELESS = 94,
        DXGI_FORMAT_BC6H_UF16 = 95,
        DXGI_FORMAT_BC6H_SF16 = 96,
        DXGI_FORMAT_BC7_TYPELESS = 97,
        DXGI_FORMAT_BC7_UNORM = 98,
        DXGI_FORMAT_BC7_UNORM_SRGB = 99,
        DXGI_FORMAT_FORCE_UINT = 0xffffffff
    }
    public enum DXGI_MODE_SCANLINE_ORDER : uint
    {
        DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0,
        DXGI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1,
        DXGI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST = 2,
        DXGI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3
    }
    public enum DXGI_MODE_SCALING : uint
    {
        DXGI_MODE_SCALING_UNSPECIFIED = 0,
        DXGI_MODE_SCALING_CENTERED = 1,
        DXGI_MODE_SCALING_STRETCHED = 2
    }
    public enum DXGI_SWAP_EFFECT : uint
    {
        DXGI_SWAP_EFFECT_DISCARD = 0,
        DXGI_SWAP_EFFECT_SEQUENTIAL = 1
    }
    [Flags]
    public enum DXGI_USAGE : uint
    {
        DXGI_USAGE_SHADER_INPUT             = ( 1 << (0 + 4) ),
        DXGI_USAGE_RENDER_TARGET_OUTPUT     = ( 1 << (1 + 4) ),
        DXGI_USAGE_BACK_BUFFER              = ( 1 << (2 + 4) ),
        DXGI_USAGE_SHARED                   = ( 1 << (3 + 4) ),
        DXGI_USAGE_READ_ONLY                = ( 1 << (4 + 4) ),
        DXGI_USAGE_DISCARD_ON_PRESENT       = ( 1 << (5 + 4) ),
        DXGI_USAGE_UNORDERED_ACCESS         = ( 1 << (6 + 4) ),
    }
    [Flags]
    public enum DXGI_SWAP_CHAIN_FLAG : uint
    {
        DXGI_SWAP_CHAIN_FLAG_NONPREROTATED = 1,
        DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH = 2,
        DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE = 4,
        DXGI_SWAP_CHAIN_FLAG_RESTRICTED_CONTENT = 8,
        DXGI_SWAP_CHAIN_FLAG_RESTRICT_SHARED_RESOURCE_DRIVER = 16,
        DXGI_SWAP_CHAIN_FLAG_DISPLAY_ONLY = 32
    }
    public enum DXGI_RESIDENCY : uint
    {	
        DXGI_RESIDENCY_FULLY_RESIDENT = 1,
	    DXGI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2,
	    DXGI_RESIDENCY_EVICTED_TO_DISK = 3
    }
    [Flags]
    public enum DXGI_PRESENT : uint
    {
        DXGI_PRESENT_TEST = 0x00000001U,
        DXGI_PRESENT_DO_NOT_SEQUENCE = 0x00000002U,
        DXGI_PRESENT_RESTART = 0x00000004U,
    }
    public enum DXGI_STATUS : int
    {
        DXGI_STATUS_OCCLUDED = (0 << 31) | (0x87a << 16) | 1,
        DXGI_STATUS_CLIPPED = (0 << 31) | (0x87a << 16) | 2,
        DXGI_STATUS_NO_REDIRECTION = (0 << 31) | (0x87a << 16) | 4,
        DXGI_STATUS_NO_DESKTOP_ACCESS = (0 << 31) | (0x87a << 16) | 5,
        DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE = (0 << 31) | (0x87a << 16) | 6,
        DXGI_STATUS_MODE_CHANGED = (0 << 31) | (0x87a << 16) | 7,
        DXGI_STATUS_MODE_CHANGE_IN_PROGRESS = (0 << 31) | (0x87a << 16) | 8,
    }
    public enum DXGI_ERROR : int
    {
        DXGI_ERROR_INVALID_CALL                  = (1 << 31) | (0x87a << 16) | (1),
        DXGI_ERROR_NOT_FOUND                     = (1 << 31) | (0x87a << 16) | (2),
        DXGI_ERROR_MORE_DATA                     = (1 << 31) | (0x87a << 16) | (3),
        DXGI_ERROR_UNSUPPORTED                   = (1 << 31) | (0x87a << 16) | (4),
        DXGI_ERROR_DEVICE_REMOVED                = (1 << 31) | (0x87a << 16) | (5),
        DXGI_ERROR_DEVICE_HUNG                   = (1 << 31) | (0x87a << 16) | (6),
        DXGI_ERROR_DEVICE_RESET                  = (1 << 31) | (0x87a << 16) | (7),
        DXGI_ERROR_WAS_STILL_DRAWING             = (1 << 31) | (0x87a << 16) | (10),
        DXGI_ERROR_FRAME_STATISTICS_DISJOINT     = (1 << 31) | (0x87a << 16) | (11),
        DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE  = (1 << 31) | (0x87a << 16) | (12),
        DXGI_ERROR_DRIVER_INTERNAL_ERROR         = (1 << 31) | (0x87a << 16) | (32),
        DXGI_ERROR_NONEXCLUSIVE                  = (1 << 31) | (0x87a << 16) | (33),
        DXGI_ERROR_NOT_CURRENTLY_AVAILABLE       = (1 << 31) | (0x87a << 16) | (34),
        DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED    = (1 << 31) | (0x87a << 16) | (35),
        DXGI_ERROR_REMOTE_OUTOFMEMORY            = (1 << 31) | (0x87a << 16) | (36),
    }
    #endregion

    #region D3D
    public enum D3D11_RETURN_CODE : int
    {
        S_OK = 0,
        S_FALSE = 1,
        E_OUTOFMEMORY = unchecked((int)(0x8007000E)),
        E_INVALIDARG = unchecked((int)(0x80070057)),
        E_FAIL = unchecked((int)(0x80004005)),
        D3DERR_WASSTILLDRAWING = (1 << 31) | (0x876 << 16) | (540),
        D3DERR_INVALIDCALL = (1 << 31) | (0x876 << 16) | (2156),
        D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD = (1 << 31) | (0x87c << 16) | (4),
        D3D11_ERROR_TOO_MANY_UNIQUE_VIEW_OBJECTS = (1 << 31) | (0x87c << 16) | (3),
        D3D11_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS = (1 << 31) | (0x87c << 16) | (1),
        D3D11_ERROR_FILE_NOT_FOUND = (1 << 31) | (0x87c << 16) | (2),
    }
    public enum D3D_DRIVER_TYPE : uint
    {
        D3D_DRIVER_TYPE_UNKNOWN = 0,
        D3D_DRIVER_TYPE_HARDWARE = (D3D_DRIVER_TYPE_UNKNOWN + 1),
        D3D_DRIVER_TYPE_REFERENCE = (D3D_DRIVER_TYPE_HARDWARE + 1),
        D3D_DRIVER_TYPE_NULL = (D3D_DRIVER_TYPE_REFERENCE + 1),
        D3D_DRIVER_TYPE_SOFTWARE = (D3D_DRIVER_TYPE_NULL + 1),
        D3D_DRIVER_TYPE_WARP
    }
    [Flags]
    public enum D3D11_CREATE_DEVICE_FLAG : uint
    {
        D3D11_CREATE_DEVICE_SINGLETHREADED = 0x1,
        D3D11_CREATE_DEVICE_DEBUG = 0x2,
        D3D11_CREATE_DEVICE_SWITCH_TO_REF = 0x4,
        D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 0x8,
        D3D11_CREATE_DEVICE_BGRA_SUPPORT = 0x20
    }
    #region D3D_FEATURE_LEVEL
    public enum D3D_FEATURE_LEVEL : uint
    {
        D3D_FEATURE_LEVEL_9_1 = 0x9100,
        D3D_FEATURE_LEVEL_9_2 = 0x9200,
        D3D_FEATURE_LEVEL_9_3 = 0x9300,
        D3D_FEATURE_LEVEL_10_0 = 0xa000,
        D3D_FEATURE_LEVEL_10_1 = 0xa100,
        D3D_FEATURE_LEVEL_11_0 = 0xb000
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_D3D_FEATURE_LEVEL
    {
        public D3D_FEATURE_LEVEL Value;
    }
    #endregion
    public enum DX_SDK_VERSIONS : uint
    {
        D3D11_SDK_VERSION = 7
    }
    public enum D3D11_FEATURE : uint
    {
        D3D11_FEATURE_THREADING = 0,
        D3D11_FEATURE_DOUBLES = (D3D11_FEATURE_THREADING + 1),
        D3D11_FEATURE_FORMAT_SUPPORT = (D3D11_FEATURE_DOUBLES + 1),
        D3D11_FEATURE_FORMAT_SUPPORT2 = (D3D11_FEATURE_FORMAT_SUPPORT + 1),
        D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS = (D3D11_FEATURE_FORMAT_SUPPORT2 + 1)
    }
    public enum D3D11_USAGE : uint
    {
        D3D11_USAGE_DEFAULT = 0,
        D3D11_USAGE_IMMUTABLE = 1,
        D3D11_USAGE_DYNAMIC = 2,
        D3D11_USAGE_STAGING = 3
    }
    [Flags]
    public enum D3DCOMPILE_OPTIONS : uint
    {
        D3DCOMPILE_DEBUG = (1 << 0),
        D3DCOMPILE_SKIP_VALIDATION = (1 << 1),
        D3DCOMPILE_SKIP_OPTIMIZATION = (1 << 2),
        D3DCOMPILE_PACK_MATRIX_ROW_MAJOR = (1 << 3),
        D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR = (1 << 4),
        D3DCOMPILE_PARTIAL_PRECISION = (1 << 5),
        D3DCOMPILE_FORCE_VS_SOFTWARE_NO_OPT = (1 << 6),
        D3DCOMPILE_FORCE_PS_SOFTWARE_NO_OPT = (1 << 7),
        D3DCOMPILE_NO_PRESHADER = (1 << 8),
        D3DCOMPILE_AVOID_FLOW_CONTROL = (1 << 9),
        D3DCOMPILE_PREFER_FLOW_CONTROL = (1 << 10),
        D3DCOMPILE_ENABLE_STRICTNESS = (1 << 11),
        D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY = (1 << 12),
        D3DCOMPILE_IEEE_STRICTNESS = (1 << 13),
        D3DCOMPILE_OPTIMIZATION_LEVEL0 = (1 << 14),
        D3DCOMPILE_OPTIMIZATION_LEVEL1 = 0,
        D3DCOMPILE_OPTIMIZATION_LEVEL2 = ((1 << 14) | (1 << 15)),
        D3DCOMPILE_OPTIMIZATION_LEVEL3 = (1 << 15),
        D3DCOMPILE_RESERVED16 = (1 << 16),
        D3DCOMPILE_RESERVED17 = (1 << 17),
        D3DCOMPILE_WARNINGS_ARE_ERRORS = (1 << 18)
    }
    [Flags]
    public enum D3D11_BIND_FLAG : uint
    {
        D3D11_BIND_VERTEX_BUFFER = 0x1,
        D3D11_BIND_INDEX_BUFFER = 0x2,
        D3D11_BIND_CONSTANT_BUFFER = 0x4,
        D3D11_BIND_SHADER_RESOURCE = 0x8,
        D3D11_BIND_STREAM_OUTPUT = 0x10,
        D3D11_BIND_RENDER_TARGET = 0x20,
        D3D11_BIND_DEPTH_STENCIL = 0x40,
        D3D11_BIND_UNORDERED_ACCESS = 0x80
    }
    [Flags]
    public enum D3D11_CPU_ACCESS_FLAG : uint
    {
        D3D11_CPU_ACCESS_WRITE = 0x10000,
        D3D11_CPU_ACCESS_READ = 0x20000
    }
    [Flags]
    public enum D3D11_RESOURCE_MISC_FLAG : uint
    {
        D3D11_RESOURCE_MISC_GENERATE_MIPS = 0x1,
        D3D11_RESOURCE_MISC_SHARED = 0x2,
        D3D11_RESOURCE_MISC_TEXTURECUBE = 0x4,
        D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS = 0x10,
        D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS = 0x20,
        D3D11_RESOURCE_MISC_BUFFER_STRUCTURED = 0x40,
        D3D11_RESOURCE_MISC_RESOURCE_CLAMP = 0x80,
        D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x100,
        D3D11_RESOURCE_MISC_GDI_COMPATIBLE = 0x200
    }
    [Flags]
    public enum D3D11_BUFFEREX_SRV_FLAG : uint
    {
        D3D11_BUFFEREX_SRV_FLAG_RAW = 0x1
    }
    [Flags]
    public enum D3D11_BUFFER_UAV_FLAG : uint
    {
        D3D11_BUFFER_UAV_FLAG_RAW = 0x1,
        D3D11_BUFFER_UAV_FLAG_APPEND = 0x2,
        D3D11_BUFFER_UAV_FLAG_COUNTER = 0x4
    }
    public enum D3D11_MAP : uint
    {
        D3D11_MAP_READ = 1,
        D3D11_MAP_WRITE = 2,
        D3D11_MAP_READ_WRITE = 3,
        D3D11_MAP_WRITE_DISCARD = 4,
        D3D11_MAP_WRITE_NO_OVERWRITE = 5
    }
    public enum D3D11_RESOURCE_DIMENSION : uint
    {	
        D3D11_RESOURCE_DIMENSION_UNKNOWN = 0,
	    D3D11_RESOURCE_DIMENSION_BUFFER = 1,
	    D3D11_RESOURCE_DIMENSION_TEXTURE1D = 2,
	    D3D11_RESOURCE_DIMENSION_TEXTURE2D = 3,
	    D3D11_RESOURCE_DIMENSION_TEXTURE3D = 4
    }
    public enum D3D_SRV_DIMENSION : uint
    {
        D3D_SRV_DIMENSION_UNKNOWN = 0,
        D3D_SRV_DIMENSION_BUFFER = 1,
        D3D_SRV_DIMENSION_TEXTURE1D = 2,
        D3D_SRV_DIMENSION_TEXTURE1DARRAY = 3,
        D3D_SRV_DIMENSION_TEXTURE2D = 4,
        D3D_SRV_DIMENSION_TEXTURE2DARRAY = 5,
        D3D_SRV_DIMENSION_TEXTURE2DMS = 6,
        D3D_SRV_DIMENSION_TEXTURE2DMSARRAY = 7,
        D3D_SRV_DIMENSION_TEXTURE3D = 8,
        D3D_SRV_DIMENSION_TEXTURECUBE = 9,
        D3D_SRV_DIMENSION_TEXTURECUBEARRAY = 10,
        D3D_SRV_DIMENSION_BUFFEREX = 11,
        D3D10_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
        D3D10_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
        D3D10_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
        D3D10_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
        D3D10_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
        D3D10_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
        D3D10_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
        D3D10_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
        D3D10_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
        D3D10_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
        D3D10_1_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
        D3D10_1_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
        D3D10_1_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
        D3D10_1_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
        D3D10_1_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
        D3D10_1_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
        D3D10_1_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
        D3D10_1_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
        D3D10_1_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
        D3D10_1_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
        D3D10_1_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY,
        D3D11_SRV_DIMENSION_UNKNOWN = D3D_SRV_DIMENSION_UNKNOWN,
        D3D11_SRV_DIMENSION_BUFFER = D3D_SRV_DIMENSION_BUFFER,
        D3D11_SRV_DIMENSION_TEXTURE1D = D3D_SRV_DIMENSION_TEXTURE1D,
        D3D11_SRV_DIMENSION_TEXTURE1DARRAY = D3D_SRV_DIMENSION_TEXTURE1DARRAY,
        D3D11_SRV_DIMENSION_TEXTURE2D = D3D_SRV_DIMENSION_TEXTURE2D,
        D3D11_SRV_DIMENSION_TEXTURE2DARRAY = D3D_SRV_DIMENSION_TEXTURE2DARRAY,
        D3D11_SRV_DIMENSION_TEXTURE2DMS = D3D_SRV_DIMENSION_TEXTURE2DMS,
        D3D11_SRV_DIMENSION_TEXTURE2DMSARRAY = D3D_SRV_DIMENSION_TEXTURE2DMSARRAY,
        D3D11_SRV_DIMENSION_TEXTURE3D = D3D_SRV_DIMENSION_TEXTURE3D,
        D3D11_SRV_DIMENSION_TEXTURECUBE = D3D_SRV_DIMENSION_TEXTURECUBE,
        D3D11_SRV_DIMENSION_TEXTURECUBEARRAY = D3D_SRV_DIMENSION_TEXTURECUBEARRAY,
        D3D11_SRV_DIMENSION_BUFFEREX = D3D_SRV_DIMENSION_BUFFEREX
    }
    public enum D3D11_UAV_DIMENSION : uint
    {
        D3D11_UAV_DIMENSION_UNKNOWN = 0,
        D3D11_UAV_DIMENSION_BUFFER = 1,
        D3D11_UAV_DIMENSION_TEXTURE1D = 2,
        D3D11_UAV_DIMENSION_TEXTURE1DARRAY = 3,
        D3D11_UAV_DIMENSION_TEXTURE2D = 4,
        D3D11_UAV_DIMENSION_TEXTURE2DARRAY = 5,
        D3D11_UAV_DIMENSION_TEXTURE3D = 8
    }
    public enum D3D11_RTV_DIMENSION : uint
    {	
        D3D11_RTV_DIMENSION_UNKNOWN	= 0,
	    D3D11_RTV_DIMENSION_BUFFER	= 1,
	    D3D11_RTV_DIMENSION_TEXTURE1D	= 2,
	    D3D11_RTV_DIMENSION_TEXTURE1DARRAY	= 3,
	    D3D11_RTV_DIMENSION_TEXTURE2D	= 4,
	    D3D11_RTV_DIMENSION_TEXTURE2DARRAY	= 5,
	    D3D11_RTV_DIMENSION_TEXTURE2DMS	= 6,
	    D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY	= 7,
	    D3D11_RTV_DIMENSION_TEXTURE3D	= 8
    }
    public enum D3D11_DSV_DIMENSION : uint
    {
        D3D11_DSV_DIMENSION_UNKNOWN	= 0,
	    D3D11_DSV_DIMENSION_TEXTURE1D	= 1,
	    D3D11_DSV_DIMENSION_TEXTURE1DARRAY	= 2,
	    D3D11_DSV_DIMENSION_TEXTURE2D	= 3,
	    D3D11_DSV_DIMENSION_TEXTURE2DARRAY	= 4,
	    D3D11_DSV_DIMENSION_TEXTURE2DMS	= 5,
	    D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY	= 6
    }
    [Flags]
    public enum D3D11_DSV_FLAG : uint
    {
        D3D11_DSV_READ_ONLY_DEPTH	= 0x1U,
	    D3D11_DSV_READ_ONLY_STENCIL	= 0x2U
    }
    public enum D3D11_INPUT_CLASSIFICATION : uint
    {
        D3D11_INPUT_PER_VERTEX_DATA	= 0,
	    D3D11_INPUT_PER_INSTANCE_DATA	= 1
    }
    public enum D3D11_BLEND : uint
    {
        D3D11_BLEND_ZERO = 1,
        D3D11_BLEND_ONE = 2,
        D3D11_BLEND_SRC_COLOR = 3,
        D3D11_BLEND_INV_SRC_COLOR = 4,
        D3D11_BLEND_SRC_ALPHA = 5,
        D3D11_BLEND_INV_SRC_ALPHA = 6,
        D3D11_BLEND_DEST_ALPHA = 7,
        D3D11_BLEND_INV_DEST_ALPHA = 8,
        D3D11_BLEND_DEST_COLOR = 9,
        D3D11_BLEND_INV_DEST_COLOR = 10,
        D3D11_BLEND_SRC_ALPHA_SAT = 11,
        D3D11_BLEND_BLEND_FACTOR = 14,
        D3D11_BLEND_INV_BLEND_FACTOR = 15,
        D3D11_BLEND_SRC1_COLOR = 16,
        D3D11_BLEND_INV_SRC1_COLOR = 17,
        D3D11_BLEND_SRC1_ALPHA = 18,
        D3D11_BLEND_INV_SRC1_ALPHA = 19
    }
    public enum D3D11_BLEND_OP : uint
    {	
        D3D11_BLEND_OP_ADD	= 1,
	    D3D11_BLEND_OP_SUBTRACT	= 2,
	    D3D11_BLEND_OP_REV_SUBTRACT	= 3,
	    D3D11_BLEND_OP_MIN	= 4,
	    D3D11_BLEND_OP_MAX	= 5
    }
    public enum D3D11_DEPTH_WRITE_MASK : uint
    {
        D3D11_DEPTH_WRITE_MASK_ZERO = 0,
        D3D11_DEPTH_WRITE_MASK_ALL = 1
    }
    public enum D3D11_COMPARISON_FUNC : uint
    {
        D3D11_COMPARISON_NEVER = 1,
        D3D11_COMPARISON_LESS = 2,
        D3D11_COMPARISON_EQUAL = 3,
        D3D11_COMPARISON_LESS_EQUAL = 4,
        D3D11_COMPARISON_GREATER = 5,
        D3D11_COMPARISON_NOT_EQUAL = 6,
        D3D11_COMPARISON_GREATER_EQUAL = 7,
        D3D11_COMPARISON_ALWAYS = 8
    }
    public enum D3D11_STENCIL_OP : uint
    {
        D3D11_STENCIL_OP_KEEP = 1,
        D3D11_STENCIL_OP_ZERO = 2,
        D3D11_STENCIL_OP_REPLACE = 3,
        D3D11_STENCIL_OP_INCR_SAT = 4,
        D3D11_STENCIL_OP_DECR_SAT = 5,
        D3D11_STENCIL_OP_INVERT = 6,
        D3D11_STENCIL_OP_INCR = 7,
        D3D11_STENCIL_OP_DECR = 8
    }
    public enum D3D11_FILL_MODE : uint
    {
        D3D11_FILL_WIREFRAME = 2,
        D3D11_FILL_SOLID = 3
    }
    public enum D3D11_CULL_MODE : uint
    {
        D3D11_CULL_NONE = 1,
        D3D11_CULL_FRONT = 2,
        D3D11_CULL_BACK = 3
    }
    public enum D3D11_FILTER : uint
    {
        D3D11_FILTER_MIN_MAG_MIP_POINT = 0,
        D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR = 0x1,
        D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x4,
        D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR = 0x5,
        D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT = 0x10,
        D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11,
        D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT = 0x14,
        D3D11_FILTER_MIN_MAG_MIP_LINEAR = 0x15,
        D3D11_FILTER_ANISOTROPIC = 0x55,
        D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT = 0x80,
        D3D11_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 0x81,
        D3D11_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 0x84,
        D3D11_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 0x85,
        D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 0x90,
        D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x91,
        D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 0x94,
        D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = 0x95,
        D3D11_FILTER_COMPARISON_ANISOTROPIC = 0xd5
    }
    public enum D3D11_TEXTURE_ADDRESS_MODE : uint
    {
        D3D11_TEXTURE_ADDRESS_WRAP = 1,
        D3D11_TEXTURE_ADDRESS_MIRROR = 2,
        D3D11_TEXTURE_ADDRESS_CLAMP = 3,
        D3D11_TEXTURE_ADDRESS_BORDER = 4,
        D3D11_TEXTURE_ADDRESS_MIRROR_ONCE = 5
    }
    public enum D3D11_QUERY : uint
    {	
        D3D11_QUERY_EVENT	= 0,
	    D3D11_QUERY_OCCLUSION	= ( D3D11_QUERY_EVENT + 1 ) ,
	    D3D11_QUERY_TIMESTAMP	= ( D3D11_QUERY_OCCLUSION + 1 ) ,
	    D3D11_QUERY_TIMESTAMP_DISJOINT	= ( D3D11_QUERY_TIMESTAMP + 1 ) ,
	    D3D11_QUERY_PIPELINE_STATISTICS	= ( D3D11_QUERY_TIMESTAMP_DISJOINT + 1 ) ,
	    D3D11_QUERY_OCCLUSION_PREDICATE	= ( D3D11_QUERY_PIPELINE_STATISTICS + 1 ) ,
	    D3D11_QUERY_SO_STATISTICS	= ( D3D11_QUERY_OCCLUSION_PREDICATE + 1 ) ,
	    D3D11_QUERY_SO_OVERFLOW_PREDICATE	= ( D3D11_QUERY_SO_STATISTICS + 1 ) ,
	    D3D11_QUERY_SO_STATISTICS_STREAM0	= ( D3D11_QUERY_SO_OVERFLOW_PREDICATE + 1 ) ,
	    D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0	= ( D3D11_QUERY_SO_STATISTICS_STREAM0 + 1 ) ,
	    D3D11_QUERY_SO_STATISTICS_STREAM1	= ( D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 + 1 ) ,
	    D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1	= ( D3D11_QUERY_SO_STATISTICS_STREAM1 + 1 ) ,
	    D3D11_QUERY_SO_STATISTICS_STREAM2	= ( D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 + 1 ) ,
	    D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2	= ( D3D11_QUERY_SO_STATISTICS_STREAM2 + 1 ) ,
	    D3D11_QUERY_SO_STATISTICS_STREAM3	= ( D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 + 1 ) ,
	    D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3	= ( D3D11_QUERY_SO_STATISTICS_STREAM3 + 1 ) 
    }
    public enum D3D11_COUNTER : uint
    {
        D3D11_COUNTER_DEVICE_DEPENDENT_0 = 0x40000000
    }
    public enum D3D11_COUNTER_TYPE : uint
    {	
        D3D11_COUNTER_TYPE_FLOAT32	= 0,
	    D3D11_COUNTER_TYPE_UINT16	= ( D3D11_COUNTER_TYPE_FLOAT32 + 1 ) ,
	    D3D11_COUNTER_TYPE_UINT32	= ( D3D11_COUNTER_TYPE_UINT16 + 1 ) ,
	    D3D11_COUNTER_TYPE_UINT64	= ( D3D11_COUNTER_TYPE_UINT32 + 1 ) 
    }
    [Flags]
    public enum D3D11_RAISE_FLAG : uint
    {
        D3D11_RAISE_FLAG_DRIVER_INTERNAL_ERROR = 0x1
    }
    [Flags]
    public enum D3D11_MAP_FLAG : uint
    {
        D3D11_MAP_FLAG_DO_NOT_WAIT = 0x100000U
    }
    public enum D3D11_PRIMITIVE_TOPOLOGY : uint
    {
        D3D_PRIMITIVE_TOPOLOGY_UNDEFINED = 0,
        D3D_PRIMITIVE_TOPOLOGY_POINTLIST = 1,
        D3D_PRIMITIVE_TOPOLOGY_LINELIST = 2,
        D3D_PRIMITIVE_TOPOLOGY_LINESTRIP = 3,
        D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST = 4,
        D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = 5,
        D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = 10,
        D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = 11,
        D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = 12,
        D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = 13,
        D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = 33,
        D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = 34,
        D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = 35,
        D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = 36,
        D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = 37,
        D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = 38,
        D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = 39,
        D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = 40,
        D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = 41,
        D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = 42,
        D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = 43,
        D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = 44,
        D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = 45,
        D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = 46,
        D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = 47,
        D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = 48,
        D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = 49,
        D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = 50,
        D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = 51,
        D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = 52,
        D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = 53,
        D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = 54,
        D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = 55,
        D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = 56,
        D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = 57,
        D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = 58,
        D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = 59,
        D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = 60,
        D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = 61,
        D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = 62,
        D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = 63,
        D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = 64,
        D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED,
        D3D10_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST,
        D3D10_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST,
        D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,
        D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
        D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
        D3D10_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ,
        D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ,
        D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ,
        D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ,
        D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED,
        D3D11_PRIMITIVE_TOPOLOGY_POINTLIST = D3D_PRIMITIVE_TOPOLOGY_POINTLIST,
        D3D11_PRIMITIVE_TOPOLOGY_LINELIST = D3D_PRIMITIVE_TOPOLOGY_LINELIST,
        D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP,
        D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST,
        D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP,
        D3D11_PRIMITIVE_TOPOLOGY_LINELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ,
        D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP_ADJ,
        D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST_ADJ,
        D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP_ADJ,
        D3D11_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST,
        D3D11_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST = D3D_PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST
    }
    [Flags]
    public enum D3D11_ASYNC_GETDATA_FLAG : uint
    {
        D3D11_ASYNC_GETDATA_DONOTFLUSH = 0x1
    }
    public enum D3D11_DEVICE_CONTEXT_TYPE : uint
    {
        D3D11_DEVICE_CONTEXT_IMMEDIATE	= 0,
	    D3D11_DEVICE_CONTEXT_DEFERRED	= ( D3D11_DEVICE_CONTEXT_IMMEDIATE + 1 ) 
    }
    #endregion
    #endregion
    
    #region Interfaces
    #region Common
    #endregion

    #region Legacy
    #region DX9
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("81BDCBCA-64D4-426d-AE8D-AD0147F4275C"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IDirect3D9
    {
        void UnUnsed_RegisterSoftwareDevice();              //STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE;
        void UnUnsed_GetAdapterCount();                     //STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE;
        void UnUnsed_GetAdapterIdentifier();                //STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) PURE;
        void UnUnsed_GetAdapterModeCount();                 //STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter,D3DFORMAT Format) PURE;
        void UnUnsed_EnumAdapterModes();                    //STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) PURE;
        void UnUnsed_GetAdapterDisplayMode();               //STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE;
        void UnUnsed_CheckDeviceType();                     //STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,D3DFORMAT AdapterFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) PURE;
        void UnUnsed_CheckDeviceFormat();                   //STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE;
        void UnUnsed_CheckDeviceMultiSampleType();          //STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) PURE;
        void UnUnsed_CheckDepthStencilMatch();              //STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE;
        void UnUnsed_CheckDeviceFormatConversion();         //STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat) PURE;
        void UnUnsed_GetDeviceCaps();                       //STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) PURE;
        void UnUnsed_GetAdapterMonitor();                   //STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE;
        void UnUnsed_CreateDevice();                        //STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) PURE;
    }
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("02177241-69FC-400C-8FF1-93A44DF6861D"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IDirect3D9Ex : IDirect3D9
    {
        #region inherit IDirect3D9
        void UnUnsed_RegisterSoftwareDevice();              //STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE;
        void UnUnsed_GetAdapterCount();                     //STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE;
        void UnUnsed_GetAdapterIdentifier();                //STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) PURE;
        void UnUnsed_GetAdapterModeCount();                 //STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter,D3DFORMAT Format) PURE;
        void UnUnsed_EnumAdapterModes();                    //STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) PURE;
        void UnUnsed_GetAdapterDisplayMode();               //STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter,D3DDISPLAYMODE* pMode) PURE;
        void UnUnsed_CheckDeviceType();                     //STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter,D3DDEVTYPE DevType,D3DFORMAT AdapterFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) PURE;
        void UnUnsed_CheckDeviceFormat();                   //STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) PURE;
        void UnUnsed_CheckDeviceMultiSampleType();          //STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) PURE;
        void UnUnsed_CheckDepthStencilMatch();              //STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) PURE;
        void UnUnsed_CheckDeviceFormatConversion();         //STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat) PURE;
        void UnUnsed_GetDeviceCaps();                       //STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) PURE;
        void UnUnsed_GetAdapterMonitor();                   //STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE;
        void UnUnsed_CreateDevice();                        //STDMETHOD(CreateDevice)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) PURE;
        #endregion
        void UnUsed_GetAdapterModeCountEx();                //STDMETHOD_(UINT, GetAdapterModeCountEx)(THIS_ UINT Adapter,CONST D3DDISPLAYMODEFILTER* pFilter ) PURE;
        void UnUsed_EnumAdapterModesEx();                   //STDMETHOD(EnumAdapterModesEx)(THIS_ UINT Adapter,CONST D3DDISPLAYMODEFILTER* pFilter,UINT Mode,D3DDISPLAYMODEEX* pMode) PURE;
        void UnUsed_GetAdapterDisplayModeEx();              //STDMETHOD(GetAdapterDisplayModeEx)(THIS_ UINT Adapter,D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE;
        void CreateDeviceEx(                                //STDMETHOD(CreateDeviceEx)(THIS_ UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,D3DDISPLAYMODEEX* pFullscreenDisplayMode,IDirect3DDevice9Ex** ppReturnedDeviceInterface) PURE;
            uint Adapter,
            D3DDEVTYPE DeviceType,
            IntPtr hFocusWindow,
            D3DCREATE BehaviorFlags,
            [In, Out, MarshalAs(UnmanagedType.LPArray)] D3DPRESENT_PARAMETERS[] pPresentationParameters,
            [In, Out, MarshalAs(UnmanagedType.LPArray)] D3DDISPLAYMODEEX[] pFullscreenDisplayMode,
            out IDirect3DDevice9Ex ppReturnedDeviceInterface
            );
        void UnUsed_GetAdapterLUID();                       //STDMETHOD(GetAdapterLUID)(THIS_ UINT Adapter,LUID * pLUID) PURE;
    }
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("B18B10CE-2649-405a-870F-95F777D4313A"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IDirect3DDevice9Ex
    {
        void UnUsed_TestCooperativeLevel();                 //STDMETHOD(TestCooperativeLevel)(THIS) PURE;
        void UnUsed_GetAvailableTextureMem();               //STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE;
        void UnUsed_EvictManagedResources();                //STDMETHOD(EvictManagedResources)(THIS) PURE;
        void UnUsed_GetDirect3D();                          //STDMETHOD(GetDirect3D)(THIS_ IDirect3D9** ppD3D9) PURE;
        void UnUsed_GetDeviceCaps();                        //STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS9* pCaps) PURE;
        void UnUsed_GetDisplayMode();                       //STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain,D3DDISPLAYMODE* pMode) PURE;
        void UnUsed_GetCreationParameters();                //STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE;
        void UnUsed_SetCursorProperties();                  //STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap) PURE;
        void UnUsed_SetCursorPosition();                    //STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE;
        void UnUsed_ShowCursor();                           //STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE;
        void UnUsed_CreateAdditionalSwapChain();            //STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) PURE;
        void UnUsed_GetSwapChain();                         //STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain,IDirect3DSwapChain9** pSwapChain) PURE;
        void UnUsed_GetNumberOfSwapChains();                //STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE;
        void UnUsed_Reset();                                //STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE;
        void UnUsed_Present();                              //STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE;
        void UnUsed_GetBackBuffer();                        //STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE;
        void UnUsed_GetRasterStatus();                      //STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) PURE;
        void UnUsed_SetDialogBoxMode();                     //STDMETHOD(SetDialogBoxMode)(THIS_ BOOL bEnableDialogs) PURE;
        void UnUsed_SetGammaRamp();                         //STDMETHOD_(void, SetGammaRamp)(THIS_ UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE;
        void UnUsed_GetGammaRamp();                         //STDMETHOD_(void, GetGammaRamp)(THIS_ UINT iSwapChain,D3DGAMMARAMP* pRamp) PURE;
        void CreateTexture(                                 //STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) PURE;
            uint Width,
            uint Height,
            uint Levels,
            D3DUSAGE Usage,
            D3DFORMAT Format,
            D3DPOOL Pool,
            out IDirect3DTexture9 ppTexture,
            [In] ref IntPtr pSharedHandle
            );
        void UnUsed_CreateVolumeTexture();                  //STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) PURE;
        void UnUsed_CreateCubeTexture();                    //STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) PURE;
        void UnUsed_CreateVertexBuffer();                   //STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) PURE;
        void UnUsed_CreateIndexBuffer();                    //STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) PURE;
        void UnUsed_CreateRenderTarget();                   //STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE;
        void UnUsed_CreateDepthStencilSurface();            //STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE;
        void UnUsed_UpdateSurface();                        //STDMETHOD(UpdateSurface)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) PURE;
        void UnUsed_UpdateTexture();                        //STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture) PURE;
        void UnUsed_GetRenderTargetData();                  //STDMETHOD(GetRenderTargetData)(THIS_ IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) PURE;
        void UnUsed_GetFrontBufferData();                   //STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,IDirect3DSurface9* pDestSurface) PURE;
        void UnUsed_StretchRect();                          //STDMETHOD(StretchRect)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) PURE;
        void UnUsed_ColorFill();                            //STDMETHOD(ColorFill)(THIS_ IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color) PURE;
        void UnUsed_CreateOffscreenPlainSurface();          //STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE;
        void UnUsed_SetRenderTarget();                      //STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget) PURE;
        void UnUsed_GetRenderTarget();                      //STDMETHOD(GetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) PURE;
        void UnUsed_SetDepthStencilSurface();               //STDMETHOD(SetDepthStencilSurface)(THIS_ IDirect3DSurface9* pNewZStencil) PURE;
        void UnUsed_GetDepthStencilSurface();               //STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface9** ppZStencilSurface) PURE;
        void UnUsed_BeginScene();                           //STDMETHOD(BeginScene)(THIS) PURE;
        void UnUsed_EndScene();                             //STDMETHOD(EndScene)(THIS) PURE;
        void UnUsed_Clear();                                //STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE;
        void UnUsed_SetTransform();                         //STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE;
        void UnUsed_GetTransform();                         //STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE;
        void UnUsed_MultiplyTransform();                    //STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE;
        void UnUsed_SetViewport();                          //STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT9* pViewport) PURE;
        void UnUsed_GetViewport();                          //STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT9* pViewport) PURE;
        void UnUsed_SetMaterial();                          //STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* pMaterial) PURE;
        void UnUsed_GetMaterial();                          //STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL9* pMaterial) PURE;
        void UnUsed_SetLight();                             //STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT9*) PURE;
        void UnUsed_GetLight();                             //STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT9*) PURE;
        void UnUsed_LightEnable();                          //STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE;
        void UnUsed_GetLightEnable();                       //STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE;
        void UnUsed_SetClipPlane();                         //STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE;
        void UnUsed_GetClipPlane();                         //STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE;
        void UnUsed_SetRenderState();                       //STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE;
        void UnUsed_GetRenderState();                       //STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE;
        void UnUsed_CreateStateBlock();                     //STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) PURE;
        void UnUsed_BeginStateBlock();                      //STDMETHOD(BeginStateBlock)(THIS) PURE;
        void UnUsed_EndStateBlock();                        //STDMETHOD(EndStateBlock)(THIS_ IDirect3DStateBlock9** ppSB) PURE;
        void UnUsed_SetClipStatus();                        //STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS9* pClipStatus) PURE;
        void UnUsed_GetClipStatus();                        //STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS9* pClipStatus) PURE;
        void UnUsed_GetTexture();                           //STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9** ppTexture) PURE;
        void UnUsed_SetTexture();                           //STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9* pTexture) PURE;
        void UnUsed_GetTextureStageState();                 //STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE;
        void UnUsed_SetTextureStageState();                 //STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE;
        void UnUsed_GetSamplerState();                      //STDMETHOD(GetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) PURE;
        void UnUsed_SetSamplerState();                      //STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) PURE;
        void UnUsed_ValidateDevice();                       //STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE;
        void UnUsed_SetPaletteEntries();                    //STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE;
        void UnUsed_GetPaletteEntries();                    //STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE;
        void UnUsed_SetCurrentTexturePalette();             //STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE;
        void UnUsed_GetCurrentTexturePalette();             //STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE;
        void UnUsed_SetScissorRect();                       //STDMETHOD(SetScissorRect)(THIS_ CONST RECT* pRect) PURE;
        void UnUsed_GetScissorRect();                       //STDMETHOD(GetScissorRect)(THIS_ RECT* pRect) PURE;
        void UnUsed_SetSoftwareVertexProcessing();          //STDMETHOD(SetSoftwareVertexProcessing)(THIS_ BOOL bSoftware) PURE;
        void UnUsed_GetSoftwareVertexProcessing();          //STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(THIS) PURE;
        void UnUsed_SetNPatchMode();                        //STDMETHOD(SetNPatchMode)(THIS_ float nSegments) PURE;
        void UnUsed_GetNPatchMode();                        //STDMETHOD_(float, GetNPatchMode)(THIS) PURE;
        void UnUsed_DrawPrimitive();                        //STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE;
        void UnUsed_DrawIndexedPrimitive();                 //STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE;
        void UnUsed_DrawPrimitiveUP();                      //STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE;
        void UnUsed_DrawIndexedPrimitiveUP();               //STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE;
        void UnUsed_ProcessVertices();                      //STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) PURE;
        void UnUsed_CreateVertexDeclaration();              //STDMETHOD(CreateVertexDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) PURE;
        void UnUsed_SetVertexDeclaration();                 //STDMETHOD(SetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9* pDecl) PURE;
        void UnUsed_GetVertexDeclaration();                 //STDMETHOD(GetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9** ppDecl) PURE;
        void UnUsed_SetFVF();                               //STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE;
        void UnUsed_GetFVF();                               //STDMETHOD(GetFVF)(THIS_ DWORD* pFVF) PURE;
        void UnUsed_CreateVertexShader();                   //STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) PURE;
        void UnUsed_SetVertexShader();                      //STDMETHOD(SetVertexShader)(THIS_ IDirect3DVertexShader9* pShader) PURE;
        void UnUsed_GetVertexShader();                      //STDMETHOD(GetVertexShader)(THIS_ IDirect3DVertexShader9** ppShader) PURE;
        void UnUsed_SetVertexShaderConstantF();             //STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE;
        void UnUsed_GetVertexShaderConstantF();             //STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE;
        void UnUsed_SetVertexShaderConstantI();             //STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE;
        void UnUsed_GetVertexShaderConstantI();             //STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE;
        void UnUsed_SetVertexShaderConstantB();             //STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT  BoolCount) PURE;
        void UnUsed_GetVertexShaderConstantB();             //STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE;
        void UnUsed_SetStreamSource();                      //STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) PURE;
        void UnUsed_GetStreamSource();                      //STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* pOffsetInBytes,UINT* pStride) PURE;
        void UnUsed_SetStreamSourceFreq();                  //STDMETHOD(SetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT Setting) PURE;
        void UnUsed_GetStreamSourceFreq();                  //STDMETHOD(GetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT* pSetting) PURE;
        void UnUsed_SetIndices();                           //STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer9* pIndexData) PURE;
        void UnUsed_GetIndices();                           //STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer9** ppIndexData) PURE;
        void UnUsed_CreatePixelShader();                    //STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) PURE;
        void UnUsed_SetPixelShader();                       //STDMETHOD(SetPixelShader)(THIS_ IDirect3DPixelShader9* pShader) PURE;
        void UnUsed_GetPixelShader();                       //STDMETHOD(GetPixelShader)(THIS_ IDirect3DPixelShader9** ppShader) PURE;
        void UnUsed_SetPixelShaderConstantF();              //STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE;
        void UnUsed_GetPixelShaderConstantF();              //STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE;
        void UnUsed_SetPixelShaderConstantI();              //STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE;
        void UnUsed_GetPixelShaderConstantI();              //STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE;
        void UnUsed_SetPixelShaderConstantB();              //STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT  BoolCount) PURE;
        void UnUsed_GetPixelShaderConstantB();              //STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE;
        void UnUsed_DrawRectPatch();                        //STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE;
        void UnUsed_DrawTriPatch();                         //STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE;
        void UnUsed_DeletePatch();                          //STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE;
        void UnUsed_CreateQuery();                          //STDMETHOD(CreateQuery)(THIS_ D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) PURE;
        void UnUsed_SetConvolutionMonoKernel();             //STDMETHOD(SetConvolutionMonoKernel)(THIS_ UINT width,UINT height,float* rows,float* columns) PURE;
        void UnUsed_ComposeRects();                         //STDMETHOD(ComposeRects)(THIS_ IDirect3DSurface9* pSrc,IDirect3DSurface9* pDst,IDirect3DVertexBuffer9* pSrcRectDescs,UINT NumRects,IDirect3DVertexBuffer9* pDstRectDescs,D3DCOMPOSERECTSOP Operation,int Xoffset,int Yoffset) PURE;
        void UnUsed_PresentEx();                            //STDMETHOD(PresentEx)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion,DWORD dwFlags) PURE;
        void UnUsed_GetGPUThreadPriority();                 //STDMETHOD(GetGPUThreadPriority)(THIS_ INT* pPriority) PURE;
        void UnUsed_SetGPUThreadPriority();                 //STDMETHOD(SetGPUThreadPriority)(THIS_ INT Priority) PURE;
        void UnUsed_WaitForVBlank();                        //STDMETHOD(WaitForVBlank)(THIS_ UINT iSwapChain) PURE;
        void UnUsed_CheckResourceResidency();               //STDMETHOD(CheckResourceResidency)(THIS_ IDirect3DResource9** pResourceArray,UINT32 NumResources) PURE;
        void UnUsed_SetMaximumFrameLatency();               //STDMETHOD(SetMaximumFrameLatency)(THIS_ UINT MaxLatency) PURE;
        void UnUsed_GetMaximumFrameLatency();               //STDMETHOD(GetMaximumFrameLatency)(THIS_ UINT* pMaxLatency) PURE;
        void UnUsed_CheckDeviceState();                     //STDMETHOD(CheckDeviceState)(THIS_ HWND hDestinationWindow) PURE;
        void UnUsed_CreateRenderTargetEx();                 //STDMETHOD(CreateRenderTargetEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE;
        void UnUsed_CreateOffscreenPlainSurfaceEx();        //STDMETHOD(CreateOffscreenPlainSurfaceEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE;
        void UnUsed_CreateDepthStencilSurfaceEx();          //STDMETHOD(CreateDepthStencilSurfaceEx)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle,DWORD Usage) PURE;
        void UnUsed_ResetEx();                              //STDMETHOD(ResetEx)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,D3DDISPLAYMODEEX *pFullscreenDisplayMode) PURE;
        void UnUsed_GetDisplayModeEx();                     //STDMETHOD(GetDisplayModeEx)(THIS_ UINT iSwapChain,D3DDISPLAYMODEEX* pMode,D3DDISPLAYROTATION* pRotation) PURE;
    }
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("85C31227-3DE5-4f00-9B3A-F11AC38C18B5"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IDirect3DTexture9
    {
        void UnUsed_GetDevice();                            //STDMETHOD(GetDevice)(THIS_ IDirect3DDevice9** ppDevice) PURE;
        void UnUsed_SetPrivateData();                       //STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid,CONST void* pData,DWORD SizeOfData,DWORD Flags) PURE;
        void UnUsed_GetPrivateData();                       //STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid,void* pData,DWORD* pSizeOfData) PURE;
        void UnUsed_FreePrivateData();                      //STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE;
        void UnUsed_SetPriority();                          //STDMETHOD_(DWORD, SetPriority)(THIS_ DWORD PriorityNew) PURE;
        void UnUsed_GetPriority();                          //STDMETHOD_(DWORD, GetPriority)(THIS) PURE;
        void UnUsed_PreLoad();                              //STDMETHOD_(void, PreLoad)(THIS) PURE;
        void UnUsed_GetType();                              //STDMETHOD_(D3DRESOURCETYPE, GetType)(THIS) PURE;
        void UnUsed_SetLOD();                               //STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE;
        void UnUsed_GetLOD();                               //STDMETHOD_(DWORD, GetLOD)(THIS) PURE;
        void UnUsed_GetLevelCount();                        //STDMETHOD_(DWORD, GetLevelCount)(THIS) PURE;
        void UnUsed_SetAutoGenFilterType();                 //STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE;
        void UnUsed_GetAutoGenFilterType();                 //STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE;
        void UnUsed_GenerateMipSubLevels();                 //STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE;
        void UnUsed_GetLevelDesc();                         //STDMETHOD(GetLevelDesc)(THIS_ UINT Level,D3DSURFACE_DESC *pDesc) PURE;
        void GetSurfaceLevel(                               //STDMETHOD(GetSurfaceLevel)(THIS_ UINT Level,IDirect3DSurface9** ppSurfaceLevel) PURE;
            uint Level,
            out IDirect3DSurface9 ppSurfaceLevel
            );
        void UnUsed_LockRect();                             //STDMETHOD(LockRect)(THIS_ UINT Level,D3DLOCKED_RECT* pLockedRect,CONST RECT* pRect,DWORD Flags) PURE;
        void UnUsed_UnlockRect();                           //STDMETHOD(UnlockRect)(THIS_ UINT Level) PURE;
        void UnUsed_AddDirtyRect();                         //STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pDirtyRect) PURE;
    }
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("0CFBAF3A-9FF6-429a-99B3-A2796AF8B89B"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IDirect3DSurface9
    {
    }
    #endregion
    #endregion

    #region DXGI
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("aec22fb8-76f3-4639-9be0-28eb43a67a2e"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IDXGIObject
    {
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            uint DataSize,                                                      ///* [in] */ UINT DataSize,
            IntPtr pData                                                        ///* [annotation][in] */__in_bcount(DataSize)  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            [MarshalAs(UnmanagedType.IUnknown), In] object pUnknown             ///* [annotation][in] */__in  const IUnknown *pUnknown) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            [In, Out] ref uint pDataSize,                                       ///* [annotation][out][in] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation][out] */__out_bcount(*pDataSize)  void *pData) = 0;
            );
        [return: MarshalAs(UnmanagedType.IUnknown)]
        object GetParent(                                                       //virtual HRESULT STDMETHODCALLTYPE GetParent(
            [In] ref Guid riid                                                  ///* [annotation][in] */__in  REFIID riid,
            /*[retval]*/                                                        ///* [annotation][retval][out] */__out  void **ppParent) = 0;
            );
    }
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("2411e7e1-12ac-4ccf-bd14-9798e8534dc0"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IDXGIAdapter : IDXGIObject
    {
        #region inherit IDXGIObject
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            uint DataSize,                                                      ///* [in] */ UINT DataSize,
            IntPtr pData                                                        ///* [annotation][in] */__in_bcount(DataSize)  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            [MarshalAs(UnmanagedType.IUnknown), In] object pUnknown             ///* [annotation][in] */__in  const IUnknown *pUnknown) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            [In, Out] ref uint pDataSize,                                       ///* [annotation][out][in] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation][out] */__out_bcount(*pDataSize)  void *pData) = 0;
            );
        [return: MarshalAs(UnmanagedType.IUnknown)]
        object GetParent(                                                       //virtual HRESULT STDMETHODCALLTYPE GetParent(
            [In] ref Guid riid                                                  ///* [annotation][in] */__in  REFIID riid,
            /*[retval]*/                                                        ///* [annotation][retval][out] */__out  void **ppParent) = 0;
            );
        #endregion
        void EnumOutputs( // 不推荐使用 - 未导入的接口IDXGIOutput                   //virtual HRESULT STDMETHODCALLTYPE EnumOutputs(
            uint Output,                                                        ///* [in] */ UINT Output,
            [MarshalAs(UnmanagedType.IUnknown), In, Out] ref object ppOutput    ///* [annotation][out][in] */__out  IDXGIOutput **ppOutput) = 0;
            );
        void GetDesc(                                                           //virtual HRESULT STDMETHODCALLTYPE GetDesc(
            [Out] out DXGI_ADAPTER_DESC pDesc                                   ///* [annotation][out] */__out  DXGI_ADAPTER_DESC *pDesc) = 0;
            );
        void CheckInterfaceSupport(                                             //virtual HRESULT STDMETHODCALLTYPE CheckInterfaceSupport(
            [In] ref Guid InterfaceName,                                        ///* [annotation][in] */__in  REFGUID InterfaceName,
            [Out] out ulong pUMDVersion                                         ///* [annotation][out] */__out  LARGE_INTEGER *pUMDVersion) = 0;
            );
    }
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("3d3e0379-f9de-4d58-bb6c-18d62992f1a6"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IDXGIDeviceSubObject : IDXGIObject
    {
        #region inherit IDXGIObject
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            uint DataSize,                                                      ///* [in] */ UINT DataSize,
            IntPtr pData                                                        ///* [annotation][in] */__in_bcount(DataSize)  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            [MarshalAs(UnmanagedType.IUnknown), In] object pUnknown             ///* [annotation][in] */__in  const IUnknown *pUnknown) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            [In, Out] ref uint pDataSize,                                       ///* [annotation][out][in] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation][out] */__out_bcount(*pDataSize)  void *pData) = 0;
            );
        [return: MarshalAs(UnmanagedType.IUnknown)]
        object GetParent(                                                       //virtual HRESULT STDMETHODCALLTYPE GetParent(
            [In] ref Guid riid                                                  ///* [annotation][in] */__in  REFIID riid,
            /*[retval]*/                                                        ///* [annotation][retval][out] */__out  void **ppParent) = 0;
            );
        #endregion
        [return: MarshalAs(UnmanagedType.IUnknown)]
        object GetDevice(                                                       //virtual HRESULT STDMETHODCALLTYPE GetDevice(
            [In] ref Guid riid                                                  ///* [annotation][in] */__in  REFIID riid,
            /*[retval]*/                                                        ///* [annotation][retval][out] */__out  void **ppDevice) = 0;
            );
    }
    #region IDXGISwapChain
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("310d36a0-d2e7-4c0a-aa04-6a9d23b8886a"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IDXGISwapChain : IDXGIDeviceSubObject
    {
        #region inherit IDXGIDeviceSubObject
        #region inherit IDXGIObject
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            uint DataSize,                                                      ///* [in] */ UINT DataSize,
            IntPtr pData                                                        ///* [annotation][in] */__in_bcount(DataSize)  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            [MarshalAs(UnmanagedType.IUnknown), In] object pUnknown             ///* [annotation][in] */__in  const IUnknown *pUnknown) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            [In, Out] ref uint pDataSize,                                       ///* [annotation][out][in] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation][out] */__out_bcount(*pDataSize)  void *pData) = 0;
            );
        [return: MarshalAs(UnmanagedType.IUnknown)]
        object GetParent(                                                       //virtual HRESULT STDMETHODCALLTYPE GetParent(
            [In] ref Guid riid                                                  ///* [annotation][in] */__in  REFIID riid,
            /*[retval]*/                                                        ///* [annotation][retval][out] */__out  void **ppParent) = 0;
            );
        #endregion
        [return: MarshalAs(UnmanagedType.IUnknown)]
        object GetDevice(                                                       //virtual HRESULT STDMETHODCALLTYPE GetDevice(
            [In] ref Guid riid                                                  ///* [annotation][in] */__in  REFIID riid,
            /*[retval]*/                                                        ///* [annotation][retval][out] */__out  void **ppDevice) = 0;
            );
        #endregion
        [PreserveSig]
        DXGI_STATUS Present(                                                    //virtual HRESULT STDMETHODCALLTYPE Present(
            uint SyncInterval,                                                  ///* [in] */ UINT SyncInterval,
            DXGI_PRESENT Flags                                                  ///* [in] */ UINT Flags) = 0;
            );
        void GetBuffer(                                                         //virtual HRESULT STDMETHODCALLTYPE GetBuffer(
            uint Buffer,                                                        ///* [in] */ UINT Buffer,
            [In] ref Guid riid,                                                 ///* [annotation][in] */__in  REFIID riid,
            [MarshalAs(UnmanagedType.IUnknown), Out] out object ppSurface       ///* [annotation][out][in] */__out  void **ppSurface) = 0;
            );
        void SetFullscreenState( // 不推荐使用 - 未导入的接口IDXGIOutput            //virtual HRESULT STDMETHODCALLTYPE SetFullscreenState(
            int Fullscreen,                                                     ///* [in] */ BOOL Fullscreen,
            [MarshalAs(UnmanagedType.IUnknown), In] object pTarget              ///* [annotation][in] */__in_opt  IDXGIOutput *pTarget) = 0;
            );
        void GetFullscreenState( // 不推荐使用 - 未导入的接口IDXGIOutput            //virtual HRESULT STDMETHODCALLTYPE GetFullscreenState(
            [Out] out int pFullscreen,                                          ///* [annotation][out] */__out  BOOL *pFullscreen,
            [MarshalAs(UnmanagedType.IUnknown), Out] out object ppOutput        ///* [annotation][out] */__out  IDXGIOutput **ppTarget) = 0;
            );
        void GetDesc(                                                           //virtual HRESULT STDMETHODCALLTYPE GetDesc(
            [Out] out DXGI_SWAP_CHAIN_DESC pDesc                                ///* [annotation][out] */__out  DXGI_SWAP_CHAIN_DESC *pDesc) = 0;
            );
        void ResizeBuffers(                                                     //virtual HRESULT STDMETHODCALLTYPE ResizeBuffers(
            uint BufferCount,                                                   ///* [in] */ UINT BufferCount,
            uint Width,                                                         ///* [in] */ UINT Width,
            uint Height,                                                        ///* [in] */ UINT Height,
            DXGI_FORMAT NewFormat,                                              ///* [in] */ DXGI_FORMAT NewFormat,
            DXGI_SWAP_CHAIN_FLAG SwapChainFlags                                 ///* [in] */ UINT SwapChainFlags) = 0;
            );
        void ResizeTarget(                                                      //virtual HRESULT STDMETHODCALLTYPE ResizeTarget(
            [In] ref DXGI_MODE_DESC pNewTargetParameters                        ///* [annotation][in] */__in  const DXGI_MODE_DESC *pNewTargetParameters) = 0;
            );
        void GetContainingOutput( // 不推荐使用 - 未导入的接口IDXGIOutput           //virtual HRESULT STDMETHODCALLTYPE GetContainingOutput(
            [MarshalAs(UnmanagedType.IUnknown), Out] out object ppOutput        ///* [annotation][out] */__out  IDXGIOutput **ppOutput) = 0;
            );
        void GetFrameStatistics(                                                //virtual HRESULT STDMETHODCALLTYPE GetFrameStatistics(
            [Out] out DXGI_FRAME_STATISTICS pStats                              ///* [annotation][out] */__out  DXGI_FRAME_STATISTICS *pStats) = 0;
            );
        void GetLastPresentCount(                                               //virtual HRESULT STDMETHODCALLTYPE GetLastPresentCount(
            [Out] out uint pLastPresentCount                                    ///* [annotation][out] */__out  UINT *pLastPresentCount) = 0;
            );
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_IDXGISwapChain : LP_IUnknown<IDXGISwapChain> { }
    #endregion
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("54ec77fa-1377-44e6-8c32-88fd5f44c84c"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IDXGIDevice : IDXGIObject
    {
        #region inherit IDXGIObject
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            uint DataSize,                                                      ///* [in] */ UINT DataSize,
            IntPtr pData                                                        ///* [annotation][in] */__in_bcount(DataSize)  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            [MarshalAs(UnmanagedType.IUnknown), In] object pUnknown             ///* [annotation][in] */__in  const IUnknown *pUnknown) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            [In, Out] ref uint pDataSize,                                       ///* [annotation][out][in] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation][out] */__out_bcount(*pDataSize)  void *pData) = 0;
            );
        [return: MarshalAs(UnmanagedType.IUnknown)]
        object GetParent(                                                       //virtual HRESULT STDMETHODCALLTYPE GetParent(
            [In] ref Guid riid                                                  ///* [annotation][in] */__in  REFIID riid,
            /*[retval]*/                                                        ///* [annotation][retval][out] */__out  void **ppParent) = 0;
            );
        #endregion
        void GetAdapter(                                                        //virtual HRESULT STDMETHODCALLTYPE GetAdapter(
            [Out] out IDXGIAdapter pAdapter                                     ///* [annotation][out] */__out  IDXGIAdapter **pAdapter) = 0;
            );
        void CreateSurface( // 不推荐使用 - 未导入的接口IDXGISurface                //virtual HRESULT STDMETHODCALLTYPE CreateSurface(
            [In] ref DXGI_SURFACE_DESC pDesc,                                   ///* [annotation][in] */__in  const DXGI_SURFACE_DESC *pDesc,
            uint NumSurfaces,                                                   ///* [in] */ UINT NumSurfaces,
            DXGI_USAGE Usage,                                                   ///* [in] */ DXGI_USAGE Usage,
            [In, Optional] LP_DXGI_SHARED_RESOURCE pSharedResource,             ///* [annotation][in] */__in_opt  const DXGI_SHARED_RESOURCE *pSharedResource,
            [MarshalAs(UnmanagedType.IUnknown), Out] out object ppSurface       ///* [annotation][out] */__out  IDXGISurface **ppSurface) = 0;
            );
        void QueryResourceResidency(                                            //virtual HRESULT STDMETHODCALLTYPE QueryResourceResidency(
            IntPtr ppResources,                                                 ///* [annotation][size_is][in] */__in_ecount(NumResources)  IUnknown *const *ppResources,
            IntPtr pResidencyStatus,                                            ///* [annotation][size_is][out] */__out_ecount(NumResources)  DXGI_RESIDENCY *pResidencyStatus,
            uint NumResources                                                   ///* [in] */ UINT NumResources) = 0;
            );
        void SetGPUThreadPriority(                                              //virtual HRESULT STDMETHODCALLTYPE SetGPUThreadPriority(
            int Priority                                                        ///* [in] */ INT Priority) = 0;
            );
        int GetGPUThreadPriority(                                               //virtual HRESULT STDMETHODCALLTYPE GetGPUThreadPriority(
            /*[retval]*/                                                        ///* [annotation][retval][out] */__out  INT *pPriority) = 0;
            );
    }
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("035f3ab4-482e-4e50-b41f-8a7f8bd8960b"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IDXGIResource : IDXGIDeviceSubObject
    {
        #region inherit IDXGIDeviceSubObject
        #region inherit IDXGIObject
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            uint DataSize,                                                      ///* [in] */ UINT DataSize,
            IntPtr pData                                                        ///* [annotation][in] */__in_bcount(DataSize)  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            [MarshalAs(UnmanagedType.IUnknown), In] object pUnknown             ///* [annotation][in] */__in  const IUnknown *pUnknown) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid Name,                                                 ///* [annotation][in] */__in  REFGUID Name,
            [In, Out] ref uint pDataSize,                                       ///* [annotation][out][in] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation][out] */__out_bcount(*pDataSize)  void *pData) = 0;
            );
        [return: MarshalAs(UnmanagedType.IUnknown)]
        object GetParent(                                                       //virtual HRESULT STDMETHODCALLTYPE GetParent(
            [In] ref Guid riid                                                  ///* [annotation][in] */__in  REFIID riid,
            /*[retval]*/                                                        ///* [annotation][retval][out] */__out  void **ppParent) = 0;
            );
        #endregion
        [return: MarshalAs(UnmanagedType.IUnknown)]
        object GetDevice(                                                       //virtual HRESULT STDMETHODCALLTYPE GetDevice(
            [In] ref Guid riid                                                  ///* [annotation][in] */__in  REFIID riid,
            /*[retval]*/                                                        ///* [annotation][retval][out] */__out  void **ppDevice) = 0;
            );
        #endregion
        void GetSharedHandle(                                       //virtual HRESULT STDMETHODCALLTYPE GetSharedHandle( 
            [Out] out IntPtr pSharedHandle                          ///* [annotation][out] */_Out_  HANDLE *pSharedHandle) = 0;
            );
        void GetUsage(                                              //virtual HRESULT STDMETHODCALLTYPE GetUsage( 
            [Out] out DXGI_USAGE pUsage                             ///* [annotation][out] */_Out_  DXGI_USAGE *pUsage) = 0;
            );
        void SetEvictionPriority(                                   //virtual HRESULT STDMETHODCALLTYPE SetEvictionPriority( 
            uint EvictionPriority                                   ///* [in] */ UINT EvictionPriority) = 0;
            );
        uint GetEvictionPriority(                                   //virtual HRESULT STDMETHODCALLTYPE GetEvictionPriority( 
            /*[retval]*/                                            ///* [annotation][retval][out] */_Out_  UINT *pEvictionPriority) = 0;
            );
    }
    #endregion

    #region D3D
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("1841e5c8-16b0-489b-bcc8-44cfb0d5deae"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11DeviceChild
    {
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
    }
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("dc8e63f3-d12b-4952-b47b-5e45026a862d"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11Resource : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetType(                                                           //virtual void STDMETHODCALLTYPE GetType(
            [Out] out D3D11_RESOURCE_DIMENSION pResourceDimension               ///* [annotation] */__out  D3D11_RESOURCE_DIMENSION *pResourceDimension) = 0;
            );
        [PreserveSig]
        void SetEvictionPriority(                                               //virtual void STDMETHODCALLTYPE SetEvictionPriority(
            uint EvictionPriority                                               ///* [annotation] */__in  UINT EvictionPriority) = 0;
            );
        [PreserveSig]
        uint GetEvictionPriority();                                             //virtual UINT STDMETHODCALLTYPE GetEvictionPriority( void) = 0;
    }
    #region ID3D11Texture2D
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("6f15aaf2-d208-4e89-9ab4-489535d34f9c"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11Texture2D : ID3D11Resource
    {
        #region inherit ID3D11Resource
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetType(                                                           //virtual void STDMETHODCALLTYPE GetType(
            [Out] out D3D11_RESOURCE_DIMENSION pResourceDimension               ///* [annotation] */__out  D3D11_RESOURCE_DIMENSION *pResourceDimension) = 0;
            );
        [PreserveSig]
        void SetEvictionPriority(                                               //virtual void STDMETHODCALLTYPE SetEvictionPriority(
            uint EvictionPriority                                               ///* [annotation] */__in  UINT EvictionPriority) = 0;
            );
        [PreserveSig]
        uint GetEvictionPriority();                                             //virtual UINT STDMETHODCALLTYPE GetEvictionPriority( void) = 0;
        #endregion
        [PreserveSig]
        void GetDesc(                                                           //virtual void STDMETHODCALLTYPE GetDesc(
            [Out] out D3D11_TEXTURE2D_DESC pDesc                                ///* [annotation] */__out  D3D11_TEXTURE2D_DESC *pDesc) = 0;
            );
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_ID3D11Texture2D : LP_IUnknown<ID3D11Texture2D> { }
    #endregion
    #region ID3D11Texture1D
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("f8fb5c27-c6b3-4f75-a4c8-439af2ef564c"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11Texture1D : ID3D11Resource
    {
        #region inherit ID3D11Resource
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetType(                                                           //virtual void STDMETHODCALLTYPE GetType(
            [Out] out D3D11_RESOURCE_DIMENSION pResourceDimension               ///* [annotation] */__out  D3D11_RESOURCE_DIMENSION *pResourceDimension) = 0;
            );
        [PreserveSig]
        void SetEvictionPriority(                                               //virtual void STDMETHODCALLTYPE SetEvictionPriority(
            uint EvictionPriority                                               ///* [annotation] */__in  UINT EvictionPriority) = 0;
            );
        [PreserveSig]
        uint GetEvictionPriority();                                             //virtual UINT STDMETHODCALLTYPE GetEvictionPriority( void) = 0;
        #endregion
        [PreserveSig]
        void GetDesc(                                                           //virtual void STDMETHODCALLTYPE GetDesc(
            [Out] out D3D11_TEXTURE1D_DESC pDesc                                ///* [annotation] */__out  D3D11_TEXTURE1D_DESC *pDesc) = 0;
            );
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_ID3D11Texture1D : LP_IUnknown<ID3D11Texture1D> { }
    #endregion
    #region ID3D11Texture3D
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("037e866e-f56d-4357-a8af-9dabbe6e250e"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11Texture3D : ID3D11Resource
    {
        #region inherit ID3D11Resource
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetType(                                                           //virtual void STDMETHODCALLTYPE GetType(
            [Out] out D3D11_RESOURCE_DIMENSION pResourceDimension               ///* [annotation] */__out  D3D11_RESOURCE_DIMENSION *pResourceDimension) = 0;
            );
        [PreserveSig]
        void SetEvictionPriority(                                               //virtual void STDMETHODCALLTYPE SetEvictionPriority(
            uint EvictionPriority                                               ///* [annotation] */__in  UINT EvictionPriority) = 0;
            );
        [PreserveSig]
        uint GetEvictionPriority();                                             //virtual UINT STDMETHODCALLTYPE GetEvictionPriority( void) = 0;
        #endregion
        [PreserveSig]
        void GetDesc(                                                           //virtual void STDMETHODCALLTYPE GetDesc(
            [Out] out D3D11_TEXTURE3D_DESC pDesc                                ///* [annotation] */__out  D3D11_TEXTURE3D_DESC *pDesc) = 0;
            );
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_ID3D11Texture3D : LP_IUnknown<ID3D11Texture3D> { }
    #endregion
    #region ID3D11Buffer
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("48570b85-d1ee-4fcd-a250-eb350722b037"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11Buffer : ID3D11Resource
    {
        #region inherit ID3D11Resource
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetType(                                                           //virtual void STDMETHODCALLTYPE GetType(
            [Out] out D3D11_RESOURCE_DIMENSION pResourceDimension               ///* [annotation] */__out  D3D11_RESOURCE_DIMENSION *pResourceDimension) = 0;
            );
        [PreserveSig]
        void SetEvictionPriority(                                               //virtual void STDMETHODCALLTYPE SetEvictionPriority(
            uint EvictionPriority                                               ///* [annotation] */__in  UINT EvictionPriority) = 0;
            );
        [PreserveSig]
        uint GetEvictionPriority();                                             //virtual UINT STDMETHODCALLTYPE GetEvictionPriority( void) = 0;
        #endregion
        [PreserveSig]
        void GetDesc(                                                           //virtual void STDMETHODCALLTYPE GetDesc(
            out D3D11_BUFFER_DESC pDesc                                         ///* [annotation] */__out  D3D11_BUFFER_DESC *pDesc) = 0;
            );
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_ID3D11Buffer : LP_IUnknown<ID3D11Buffer> { }
    #endregion
    #region ID3D11Device
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("db6f6ddb-ac77-4e88-8253-819df9bbf140"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11Device
    {
        void CreateBuffer(                                                      //virtual HRESULT STDMETHODCALLTYPE CreateBuffer(
            [In] ref D3D11_BUFFER_DESC pDesc,                                   ///* [annotation] */__in  const D3D11_BUFFER_DESC *pDesc,
            [In] LP_D3D11_SUBRESOURCE_DATA pInitialData = null,                 ///* [annotation] */__in_opt  const D3D11_SUBRESOURCE_DATA *pInitialData,
            [Out] LP_ID3D11Buffer ppBuffer = null                               ///* [annotation] */__out_opt  ID3D11Buffer **ppBuffer) = 0;
            );
        void CreateTexture1D(                                                   //virtual HRESULT STDMETHODCALLTYPE CreateTexture1D(
            [In] ref D3D11_TEXTURE1D_DESC pDesc,                                ///* [annotation] */__in  const D3D11_TEXTURE1D_DESC *pDesc,
            [In] LP_D3D11_SUBRESOURCE_DATA pInitialData = null,                 ///* [annotation] */__in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize)  const D3D11_SUBRESOURCE_DATA *pInitialData,
            [Out] LP_ID3D11Texture1D ppTexture1D = null                         ///* [annotation] */__out_opt  ID3D11Texture1D **ppTexture1D) = 0;
            );
        void CreateTexture2D(                                                   //virtual HRESULT STDMETHODCALLTYPE CreateTexture2D(
            [In] ref D3D11_TEXTURE2D_DESC pDesc,                                ///* [annotation] */__in  const D3D11_TEXTURE2D_DESC *pDesc,
            [In] LP_D3D11_SUBRESOURCE_DATA pInitialData = null,                 ///* [annotation] */__in_xcount_opt(pDesc->MipLevels * pDesc->ArraySize)  const D3D11_SUBRESOURCE_DATA *pInitialData,
            [Out] LP_ID3D11Texture2D ppTexture2D = null                         ///* [annotation] */__out_opt  ID3D11Texture2D **ppTexture2D) = 0;
            );
        void CreateTexture3D(                                                   //virtual HRESULT STDMETHODCALLTYPE CreateTexture3D(
            [In] ref D3D11_TEXTURE3D_DESC pDesc,                                ///* [annotation] */__in  const D3D11_TEXTURE3D_DESC *pDesc,
            [In] LP_D3D11_SUBRESOURCE_DATA pInitialData = null,                 ///* [annotation] */__in_xcount_opt(pDesc->MipLevels)  const D3D11_SUBRESOURCE_DATA *pInitialData,
            [Out] LP_ID3D11Texture3D ppTexture3D = null                         ///* [annotation] */__out_opt  ID3D11Texture3D **ppTexture3D) = 0;
            );
        void CreateShaderResourceView(                                          //virtual HRESULT STDMETHODCALLTYPE CreateShaderResourceView(
            ID3D11Resource pResource,                                           ///* [annotation] */__in  ID3D11Resource *pResource,
            [In] LP_D3D11_SHADER_RESOURCE_VIEW_DESC pDesc = null,               ///* [annotation] */__in_opt  const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc,
            [Out] LP_ID3D11ShaderResourceView pSRView = null                    ///* [annotation] */__out_opt  ID3D11ShaderResourceView **ppSRView) = 0;
            );
        void CreateUnorderedAccessView(                                         //virtual HRESULT STDMETHODCALLTYPE CreateUnorderedAccessView(
            ID3D11Resource pResource,                                           ///* [annotation] */__in  ID3D11Resource *pResource,
            [In] LP_D3D11_UNORDERED_ACCESS_VIEW_DESC pDesc = null,              ///* [annotation] */__in_opt  const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc,
            [Out] LP_ID3D11UnorderedAccessView pUAView = null                   ///* [annotation] */__out_opt  ID3D11UnorderedAccessView **ppUAView) = 0;
            );
        void CreateRenderTargetView(                                            //virtual HRESULT STDMETHODCALLTYPE CreateRenderTargetView(
            ID3D11Resource pResource,                                           ///* [annotation] */__in  ID3D11Resource *pResource,
            [In] LP_D3D11_RENDER_TARGET_VIEW_DESC pDesc = null,                 ///* [annotation] */__in_opt  const D3D11_RENDER_TARGET_VIEW_DESC *pDesc,
            [Out] LP_ID3D11RenderTargetView ppRTView = null                     ///* [annotation] */__out_opt  ID3D11RenderTargetView **ppRTView) = 0;
            );
        void CreateDepthStencilView(                                            //virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilView(
            ID3D11Resource pResource,                                           ///* [annotation] */__in  ID3D11Resource *pResource,
            [In] LP_D3D11_DEPTH_STENCIL_VIEW_DESC pDesc = null,                 ///* [annotation] */__in_opt  const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc,
            [Out] LP_ID3D11DepthStencilView ppDepthStencilView = null           ///* [annotation] */__out_opt  ID3D11DepthStencilView **ppDepthStencilView) = 0;
            );
        void CreateInputLayout(                                                 //virtual HRESULT STDMETHODCALLTYPE CreateInputLayout(
            IntPtr pInputElementDescs,                                          ///* [annotation] */__in_ecount(NumElements)  const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs,
            uint NumElements,                                                   ///* [annotation] */__in_range( 0, D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT )  UINT NumElements,
            IntPtr pShaderBytecodeWithInputSignature,                           ///* [annotation] */__in  const void *pShaderBytecodeWithInputSignature,
            IntPtr BytecodeLength,                                              ///* [annotation] */__in  SIZE_T BytecodeLength,
            [Out] LP_ID3D11InputLayout ppInputLayout = null                     ///* [annotation] */__out_opt  ID3D11InputLayout **ppInputLayout) = 0;
            );
        void CreateVertexShader(                                                //virtual HRESULT STDMETHODCALLTYPE CreateVertexShader(
            IntPtr pShaderBytecode,                                             ///* [annotation] */__in  const void *pShaderBytecode,
            IntPtr BytecodeLength,                                              ///* [annotation] */__in  SIZE_T BytecodeLength,
            ID3D11ClassLinkage pClassLinkage = null,                            ///* [annotation] */__in_opt  ID3D11ClassLinkage *pClassLinkage,
            [Out] LP_ID3D11VertexShader ppVertexShader = null                   ///* [annotation] */__out_opt  ID3D11VertexShader **ppVertexShader) = 0;
            );
        void CreateGeometryShader(                                              //virtual HRESULT STDMETHODCALLTYPE CreateGeometryShader(
            IntPtr pShaderBytecode,                                             ///* [annotation] */__in  const void *pShaderBytecode,
            IntPtr BytecodeLength,                                              ///* [annotation] */__in  SIZE_T BytecodeLength,
            ID3D11ClassLinkage pClassLinkage = null,                            ///* [annotation] */__in_opt  ID3D11ClassLinkage *pClassLinkage,
            [Out] LP_ID3D11GeometryShader ppGeometryShader = null               ///* [annotation] */__out_opt  ID3D11GeometryShader **ppGeometryShader) = 0;
            );
        void CreateGeometryShaderWithStreamOutput(                                          //virtual HRESULT STDMETHODCALLTYPE CreateGeometryShaderWithStreamOutput(
            IntPtr pShaderBytecode,                                                         ///* [annotation] */__in  const void *pShaderBytecode,
            IntPtr BytecodeLength,                                                          ///* [annotation] */__in  SIZE_T BytecodeLength,
            IntPtr pSODeclaration = default(IntPtr),                                        ///* [annotation] */__in_ecount_opt(NumEntries)  const D3D11_SO_DECLARATION_ENTRY *pSODeclaration,
            uint NumEntries = 0,                                                            ///* [annotation] */__in_range( 0, D3D11_SO_STREAM_COUNT * D3D11_SO_OUTPUT_COMPONENT_COUNT )  UINT NumEntries,
            IntPtr pBufferStrides = default(IntPtr),                                        ///* [annotation] */__in_ecount_opt(NumStrides)  const UINT *pBufferStrides,
            uint NumStrides = 0,                                                            ///* [annotation] */__in_range( 0, D3D11_SO_BUFFER_SLOT_COUNT )  UINT NumStrides,
            uint RasterizedStream = DX11_Guids_And_Consts.D3D11_SO_NO_RASTERIZED_STREAM,    ///* [annotation] */__in  UINT RasterizedStream,
            ID3D11ClassLinkage pClassLinkage = null,                                        ///* [annotation] */__in_opt  ID3D11ClassLinkage *pClassLinkage,
            [Out] LP_ID3D11GeometryShader ppGeometryShader = null                           ///* [annotation] */__out_opt  ID3D11GeometryShader **ppGeometryShader) = 0;
            );
        void CreatePixelShader(                                                 //virtual HRESULT STDMETHODCALLTYPE CreatePixelShader(
            IntPtr pShaderBytecode,                                             ///* [annotation] */__in  const void *pShaderBytecode,
            IntPtr BytecodeLength,                                              ///* [annotation] */__in  SIZE_T BytecodeLength,
            ID3D11ClassLinkage pClassLinkage = null,                            ///* [annotation] */__in_opt  ID3D11ClassLinkage *pClassLinkage,
            [Out] LP_ID3D11PixelShader ppPixelShader = null                     ///* [annotation] */__out_opt  ID3D11PixelShader **ppPixelShader) = 0;
            );
        void CreateHullShader(                                                  //virtual HRESULT STDMETHODCALLTYPE CreateHullShader(
            IntPtr pShaderBytecode,                                             ///* [annotation] */__in  const void *pShaderBytecode,
            IntPtr BytecodeLength,                                              ///* [annotation] */__in  SIZE_T BytecodeLength,
            ID3D11ClassLinkage pClassLinkage = null,                            ///* [annotation] */__in_opt  ID3D11ClassLinkage *pClassLinkage,
            [Out] LP_ID3D11HullShader ppHullShader = null                       ///* [annotation] */__out_opt  ID3D11HullShader **ppHullShader) = 0;
            );
        void CreateDomainShader(                                                //virtual HRESULT STDMETHODCALLTYPE CreateDomainShader(
            IntPtr pShaderBytecode,                                             ///* [annotation] */__in  const void *pShaderBytecode,
            IntPtr BytecodeLength,                                              ///* [annotation] */__in  SIZE_T BytecodeLength,
            ID3D11ClassLinkage pClassLinkage = null,                            ///* [annotation] */__in_opt  ID3D11ClassLinkage *pClassLinkage,
            [Out] LP_ID3D11DomainShader ppDomainShader = null                   ///* [annotation] */__out_opt  ID3D11DomainShader **ppDomainShader) = 0;
            );
        void CreateComputeShader(                                               //virtual HRESULT STDMETHODCALLTYPE CreateComputeShader(
            IntPtr pShaderBytecode,                                             ///* [annotation] */__in  const void *pShaderBytecode,
            IntPtr BytecodeLength,                                              ///* [annotation] */__in  SIZE_T BytecodeLength,
            ID3D11ClassLinkage pClassLinkage = null,                            ///* [annotation] */__in_opt  ID3D11ClassLinkage *pClassLinkage,
            [Out] LP_ID3D11ComputeShader ppComputeShader = null                 ///* [annotation] */__out_opt  ID3D11ComputeShader **ppComputeShader) = 0;
            );
        void CreateClassLinkage(                                                //virtual HRESULT STDMETHODCALLTYPE CreateClassLinkage(
            [Out] out ID3D11ClassLinkage ppLinkage                              ///* [annotation] */__out  ID3D11ClassLinkage **ppLinkage) = 0;
            );
        void CreateBlendState(                                                  //virtual HRESULT STDMETHODCALLTYPE CreateBlendState(
            [In] ref D3D11_BLEND_DESC pBlendStateDesc,                          ///* [annotation] */__in  const D3D11_BLEND_DESC *pBlendStateDesc,
            [Out] out ID3D11BlendState ppBlendState                             ///* [annotation] */__out_opt  ID3D11BlendState **ppBlendState) = 0;
            );
        void CreateDepthStencilState(                                           //virtual HRESULT STDMETHODCALLTYPE CreateDepthStencilState(
            [In] ref D3D11_DEPTH_STENCIL_DESC pDepthStencilDesc,                ///* [annotation] */__in  const D3D11_DEPTH_STENCIL_DESC *pDepthStencilDesc,
            [Out] out ID3D11DepthStencilState ppDepthStencilState               ///* [annotation] */__out_opt  ID3D11DepthStencilState **ppDepthStencilState) = 0;
            );
        void CreateRasterizerState(                                             //virtual HRESULT STDMETHODCALLTYPE CreateRasterizerState(
            [In] ref D3D11_RASTERIZER_DESC pRasterizerDesc,                     ///* [annotation] */__in  const D3D11_RASTERIZER_DESC *pRasterizerDesc,
            [Out] out ID3D11RasterizerState ppRasterizerState                   ///* [annotation] */__out_opt  ID3D11RasterizerState **ppRasterizerState) = 0;
            );
        void CreateSamplerState(                                                //virtual HRESULT STDMETHODCALLTYPE CreateSamplerState(
            [In] ref D3D11_SAMPLER_DESC pSamplerDesc,                           ///* [annotation] */__in  const D3D11_SAMPLER_DESC *pSamplerDesc,
            [Out] out ID3D11SamplerState ppSamplerState                         ///* [annotation] */__out_opt  ID3D11SamplerState **ppSamplerState) = 0;
            );
        void CreateQuery(                                                       //virtual HRESULT STDMETHODCALLTYPE CreateQuery(
            [In] ref D3D11_QUERY_DESC pQueryDesc,                               ///* [annotation] */__in  const D3D11_QUERY_DESC *pQueryDesc,
            [Out] out ID3D11Query ppQuery                                       ///* [annotation] */__out_opt  ID3D11Query **ppQuery) = 0;
            );
        void CreatePredicate(                                                   //virtual HRESULT STDMETHODCALLTYPE CreatePredicate(
            [In] ref D3D11_QUERY_DESC pPredicateDesc,                           ///* [annotation] */__in  const D3D11_QUERY_DESC *pPredicateDesc,
            [Out] out ID3D11Predicate ppPredicate                               ///* [annotation] */__out_opt  ID3D11Predicate **ppPredicate) = 0;
            );
        void CreateCounter(                                                     //virtual HRESULT STDMETHODCALLTYPE CreateCounter(
            [In] ref D3D11_COUNTER_DESC pCounterDesc,                           ///* [annotation] */__in  const D3D11_COUNTER_DESC *pCounterDesc,
            [Out] out ID3D11Counter ppCounter                                   ///* [annotation] */__out_opt  ID3D11Counter **ppCounter) = 0;
            );
        void CreateDeferredContext(                                             //virtual HRESULT STDMETHODCALLTYPE CreateDeferredContext(
            uint ContextFlags,                                                  //UINT ContextFlags,
            [Out] out ID3D11DeviceContext ppDeferredContext                     ///* [annotation] */__out_opt  ID3D11DeviceContext **ppDeferredContext) = 0;
            );
        void OpenSharedResource(                                                //virtual HRESULT STDMETHODCALLTYPE OpenSharedResource(
            [In] IntPtr hResource,                                              ///* [annotation] */__in  HANDLE hResource,
            [In] ref Guid ReturnedInterface,                                    ///* [annotation] */__in  REFIID ReturnedInterface,
            [Out, MarshalAs(UnmanagedType.IUnknown)] out object ppResource      ///* [annotation] */__out_opt  void **ppResource) = 0;
            );
        void CheckFormatSupport(                                                //virtual HRESULT STDMETHODCALLTYPE CheckFormatSupport(
            DXGI_FORMAT Format,                                                 ///* [annotation] */__in  DXGI_FORMAT Format,
            [Out] out uint pFormatSupport                                       ///* [annotation] */__out  UINT *pFormatSupport) = 0;
            );
        void CheckMultisampleQualityLevels(                                     //virtual HRESULT STDMETHODCALLTYPE CheckMultisampleQualityLevels(
            DXGI_FORMAT Format,                                                 ///* [annotation] */__in  DXGI_FORMAT Format,
            uint SampleCount,                                                   ///* [annotation] */__in  UINT SampleCount,
            [Out] out uint pNumQualityLevels                                    ///* [annotation] */__out  UINT *pNumQualityLevels) = 0;
            );
        [PreserveSig]
        void CheckCounterInfo(                                                  //virtual void STDMETHODCALLTYPE CheckCounterInfo(
            [Out] out D3D11_COUNTER_INFO pCounterInfo                           ///* [annotation] */__out  D3D11_COUNTER_INFO *pCounterInfo) = 0;
            );
        void CheckCounter(                                                              //virtual HRESULT STDMETHODCALLTYPE CheckCounter(
            [In] ref D3D11_COUNTER_DESC pDesc,                                          ///* [annotation] */__in  const D3D11_COUNTER_DESC *pDesc,
            [Out] out D3D11_COUNTER_TYPE pType,                                         ///* [annotation] */__out  D3D11_COUNTER_TYPE *pType,
            [Out] out uint pActiveCounters,                                             ///* [annotation] */__out  UINT *pActiveCounters,
            [Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder szName = null,          ///* [annotation] */__out_ecount_opt(*pNameLength)  LPSTR szName,
            [In, Out] LP_UInt32 pNameLength = null,                                     ///* [annotation] */__inout_opt  UINT *pNameLength,
            [Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder szUnits = null,         ///* [annotation] */__out_ecount_opt(*pUnitsLength)  LPSTR szUnits,
            [In, Out] LP_UInt32 pUnitsLength = null,                                    ///* [annotation] */__inout_opt  UINT *pUnitsLength,
            [Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder szDescription = null,   ///* [annotation] */__out_ecount_opt(*pDescriptionLength)  LPSTR szDescription,
            [In, Out] LP_UInt32 pDescriptionLength = null                               ///* [annotation] */__inout_opt  UINT *pDescriptionLength) = 0;
            );
        void CheckFeatureSupport(                                               //virtual HRESULT STDMETHODCALLTYPE CheckFeatureSupport(
            D3D11_FEATURE Feature,                                              //D3D11_FEATURE Feature,
            IntPtr pFeatureSupportData,                                         ///* [annotation] */__out_bcount(FeatureSupportDataSize)  void *pFeatureSupportData,
            uint FeatureSupportDataSize                                         //UINT FeatureSupportDataSize) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt(*pDataSize)  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt(DataSize)  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        [PreserveSig]
        D3D_FEATURE_LEVEL GetFeatureLevel(                                      //virtual D3D_FEATURE_LEVEL STDMETHODCALLTYPE GetFeatureLevel( void) = 0;
            );
        [PreserveSig]
        uint GetCreationFlags(                                                  //virtual UINT STDMETHODCALLTYPE GetCreationFlags( void) = 0;
            );
        [PreserveSig]
        DXGI_ERROR GetDeviceRemovedReason(                                      //virtual HRESULT STDMETHODCALLTYPE GetDeviceRemovedReason( void) = 0;
            );
        [PreserveSig]
        void GetImmediateContext(                                               //virtual void STDMETHODCALLTYPE GetImmediateContext(
            out ID3D11DeviceContext ppImmediateContext                          ///* [annotation] */__out  ID3D11DeviceContext **ppImmediateContext) = 0;
            );
        void SetExceptionMode(                                                  //virtual HRESULT STDMETHODCALLTYPE SetExceptionMode(
            D3D11_RAISE_FLAG RaiseFlags                                         //UINT RaiseFlags) = 0;
            );
        [PreserveSig]
        D3D11_RAISE_FLAG GetExceptionMode(                                      //virtual UINT STDMETHODCALLTYPE GetExceptionMode( void) = 0;
            );
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_ID3D11Device : LP_IUnknown<ID3D11Device> { }
    #endregion
    #region ID3D11DeviceContext
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("c0bfa96c-e089-44fb-8eaf-26f8796190da"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11DeviceContext : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void VSSetConstantBuffers(                                                                  //virtual void STDMETHODCALLTYPE VSSetConstantBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppConstantBuffers                 ///* [annotation] */__in_ecount(NumBuffers)  ID3D11Buffer *const *ppConstantBuffers) = 0;
            );
        [PreserveSig]
        void PSSetShaderResources(                                                                  //virtual void STDMETHODCALLTYPE PSSetShaderResources(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumViews,                                                                          ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumViews,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11ShaderResourceView[] ppShaderResourceViews ///* [annotation] */__in_ecount(NumViews)  ID3D11ShaderResourceView *const *ppShaderResourceViews) = 0;
            );
        [PreserveSig]
        void PSSetShader(                                                                           //virtual void STDMETHODCALLTYPE PSSetShader(
            [In] ID3D11PixelShader pPixelShader,                                                    ///* [annotation] */__in_opt  ID3D11PixelShader *pPixelShader,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11ClassInstance[] ppClassInstances,          ///* [annotation] */__in_ecount_opt(NumClassInstances)  ID3D11ClassInstance *const *ppClassInstances,
            uint NumClassInstances                                                                  //UINT NumClassInstances) = 0;
            );
        [PreserveSig]
        void PSSetSamplers(                                                                         //virtual void STDMETHODCALLTYPE PSSetSamplers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumSamplers,                                                                       ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )  UINT NumSamplers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11SamplerState[] ppSamplers                  ///* [annotation] */__in_ecount(NumSamplers)  ID3D11SamplerState *const *ppSamplers) = 0;
            );
        [PreserveSig]
        void VSSetShader(                                                                           //virtual void STDMETHODCALLTYPE VSSetShader(
            [In] ID3D11VertexShader pVertexShader,                                                  ///* [annotation] */__in_opt  ID3D11VertexShader *pVertexShader,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11ClassInstance[] ppClassInstances,          ///* [annotation] */__in_ecount_opt(NumClassInstances)  ID3D11ClassInstance *const *ppClassInstances,
            uint NumClassInstances                                                                  //UINT NumClassInstances) = 0;
            );
        [PreserveSig]
        void DrawIndexed(                                                                           //virtual void STDMETHODCALLTYPE DrawIndexed(
            uint IndexCount,                                                                        ///* [annotation] */__in  UINT IndexCount,
            uint StartIndexLocation,                                                                ///* [annotation] */__in  UINT StartIndexLocation,
            int BaseVertexLocation                                                                  ///* [annotation] */__in  INT BaseVertexLocation) = 0;
            );
        [PreserveSig]
        void Draw(                                                                                  //virtual void STDMETHODCALLTYPE Draw(
            uint VertexCount,                                                                       ///* [annotation] */__in  UINT VertexCount,
            uint StartVertexLocation                                                                ///* [annotation] */__in  UINT StartVertexLocation) = 0;
            );
        void Map(                                                                                   //virtual HRESULT STDMETHODCALLTYPE Map(
            [In] ID3D11Resource pResource,                                                          ///* [annotation] */__in  ID3D11Resource *pResource,
            uint Subresource,                                                                       ///* [annotation] */__in  UINT Subresource,
            D3D11_MAP MapType,                                                                      ///* [annotation] */__in  D3D11_MAP MapType,
            D3D11_MAP_FLAG MapFlags,                                                                ///* [annotation] */__in  UINT MapFlags,
            out D3D11_MAPPED_SUBRESOURCE pMappedResource                                            ///* [annotation] */__out  D3D11_MAPPED_SUBRESOURCE *pMappedResource) = 0;
            );
        [PreserveSig]
        void Unmap(                                                                                 //virtual void STDMETHODCALLTYPE Unmap(
            [In] ID3D11Resource pResource,                                                          ///* [annotation] */__in  ID3D11Resource *pResource,
            uint Subresource                                                                        ///* [annotation] */__in  UINT Subresource) = 0;
            );
        [PreserveSig]
        void PSSetConstantBuffers(                                                                  //virtual void STDMETHODCALLTYPE PSSetConstantBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppConstantBuffers                 ///* [annotation] */__in_ecount(NumBuffers)  ID3D11Buffer *const *ppConstantBuffers) = 0;
            );
        [PreserveSig]
        void IASetInputLayout(                                                                      //virtual void STDMETHODCALLTYPE IASetInputLayout(
            [In] ID3D11InputLayout pInputLayout                                                     ///* [annotation] */__in_opt  ID3D11InputLayout *pInputLayout) = 0;
            );
        [PreserveSig]
        void IASetVertexBuffers(                                                                    //virtual void STDMETHODCALLTYPE IASetVertexBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppVertexBuffers,                  ///* [annotation] */__in_ecount(NumBuffers)  ID3D11Buffer *const *ppVertexBuffers,
            [In, MarshalAs(UnmanagedType.LPArray)] uint[] pStrides,                                 ///* [annotation] */__in_ecount(NumBuffers)  const UINT *pStrides,
            [In, MarshalAs(UnmanagedType.LPArray)] uint[] pOffsets                                  ///* [annotation] */__in_ecount(NumBuffers)  const UINT *pOffsets) = 0;
            );
        [PreserveSig]
        void IASetIndexBuffer(                                                                      //virtual void STDMETHODCALLTYPE IASetIndexBuffer(
            [In] ID3D11Buffer pIndexBuffer,                                                         ///* [annotation] */__in_opt  ID3D11Buffer *pIndexBuffer,
            DXGI_FORMAT Format,                                                                     ///* [annotation] */__in  DXGI_FORMAT Format,
            uint Offset                                                                             ///* [annotation] */__in  UINT Offset) = 0;
            );
        [PreserveSig]
        void DrawIndexedInstanced(                                                                  //virtual void STDMETHODCALLTYPE DrawIndexedInstanced(
            uint IndexCountPerInstance,                                                             ///* [annotation] */__in  UINT IndexCountPerInstance,
            uint InstanceCount,                                                                     ///* [annotation] */__in  UINT InstanceCount,
            uint StartIndexLocation,                                                                ///* [annotation] */__in  UINT StartIndexLocation,
            int BaseVertexLocation,                                                                 ///* [annotation] */__in  INT BaseVertexLocation,
            uint StartInstanceLocation                                                              ///* [annotation] */__in  UINT StartInstanceLocation) = 0;
            );
        [PreserveSig]
        void DrawInstanced(                                                                         //virtual void STDMETHODCALLTYPE DrawInstanced(
            uint VertexCountPerInstance,                                                            ///* [annotation] */__in  UINT VertexCountPerInstance,
            uint InstanceCount,                                                                     ///* [annotation] */__in  UINT InstanceCount,
            uint StartVertexLocation,                                                               ///* [annotation] */__in  UINT StartVertexLocation,
            uint StartInstanceLocation                                                              ///* [annotation] */__in  UINT StartInstanceLocation) = 0;
            );
        [PreserveSig]
        void GSSetConstantBuffers(                                                                  //virtual void STDMETHODCALLTYPE GSSetConstantBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppConstantBuffers                 ///* [annotation] */__in_ecount(NumBuffers)  ID3D11Buffer *const *ppConstantBuffers) = 0;
            );
        [PreserveSig]
        void GSSetShader(                                                                           //virtual void STDMETHODCALLTYPE GSSetShader(
            [In] ID3D11GeometryShader pShader,                                                      ///* [annotation] */__in_opt  ID3D11GeometryShader *pShader,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11ClassInstance[] ppClassInstances,          ///* [annotation] */__in_ecount_opt(NumClassInstances)  ID3D11ClassInstance *const *ppClassInstances,
            uint NumClassInstances                                                                  //UINT NumClassInstances) = 0;
            );
        [PreserveSig]
        void IASetPrimitiveTopology(                                                                //virtual void STDMETHODCALLTYPE IASetPrimitiveTopology(
            D3D11_PRIMITIVE_TOPOLOGY Topology                                                       ///* [annotation] */__in  D3D11_PRIMITIVE_TOPOLOGY Topology) = 0;
            );
        [PreserveSig]
        void VSSetShaderResources(                                                                  //virtual void STDMETHODCALLTYPE VSSetShaderResources(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumViews,                                                                          ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumViews,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11ShaderResourceView[] ppShaderResourceViews ///* [annotation] */__in_ecount(NumViews)  ID3D11ShaderResourceView *const *ppShaderResourceViews) = 0;
            );
        [PreserveSig]
        void VSSetSamplers(                                                                         //virtual void STDMETHODCALLTYPE VSSetSamplers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumSamplers,                                                                       ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )  UINT NumSamplers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11SamplerState[] ppSamplers                  ///* [annotation] */__in_ecount(NumSamplers)  ID3D11SamplerState *const *ppSamplers) = 0;
            );
        [PreserveSig]
        void Begin(                                                                                 //virtual void STDMETHODCALLTYPE Begin(
            [In] ID3D11Asynchronous pAsync                                                          ///* [annotation] */__in  ID3D11Asynchronous *pAsync) = 0;
            );
        [PreserveSig]
        void End(                                                                                   //virtual void STDMETHODCALLTYPE End(
            [In] ID3D11Asynchronous pAsync                                                          ///* [annotation] */__in  ID3D11Asynchronous *pAsync) = 0;
            );
        [PreserveSig]
        D3D11_RETURN_CODE GetData(                                                                  //virtual HRESULT STDMETHODCALLTYPE GetData(
            [In] ID3D11Asynchronous pAsync,                                                         ///* [annotation] */__in  ID3D11Asynchronous *pAsync,
            IntPtr pData,                                                                           ///* [annotation] */__out_bcount_opt( DataSize )  void *pData,
            uint DataSize,                                                                          ///* [annotation] */__in  UINT DataSize,
            D3D11_ASYNC_GETDATA_FLAG GetDataFlags                                                   ///* [annotation] */__in  UINT GetDataFlags) = 0;
            );
        [PreserveSig]
        void SetPredication(                                                                        //virtual void STDMETHODCALLTYPE SetPredication(
            [In] ID3D11Predicate pPredicate,                                                        ///* [annotation] */__in_opt  ID3D11Predicate *pPredicate,
            int PredicateValue                                                                      ///* [annotation] */__in  BOOL PredicateValue) = 0;
            );
        [PreserveSig]
        void GSSetShaderResources(                                                                  //virtual void STDMETHODCALLTYPE GSSetShaderResources(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumViews,                                                                          ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumViews,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11ShaderResourceView[] ppShaderResourceViews ///* [annotation] */__in_ecount(NumViews)  ID3D11ShaderResourceView *const *ppShaderResourceViews) = 0;
            );
        [PreserveSig]
        void GSSetSamplers(                                                                         //virtual void STDMETHODCALLTYPE GSSetSamplers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumSamplers,                                                                       ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )  UINT NumSamplers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11SamplerState[] ppSamplers                  ///* [annotation] */__in_ecount(NumSamplers)  ID3D11SamplerState *const *ppSamplers) = 0;
            );
        [PreserveSig]
        void OMSetRenderTargets(                                                                    //virtual void STDMETHODCALLTYPE OMSetRenderTargets(
            uint NumViews,                                                                          ///* [annotation] */__in_range( 0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT )  UINT NumViews,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11RenderTargetView[] ppRenderTargetViews,    ///* [annotation] */__in_ecount_opt(NumViews)  ID3D11RenderTargetView *const *ppRenderTargetViews,
            [In] ID3D11DepthStencilView pDepthStencilView = null                                    ///* [annotation] */__in_opt  ID3D11DepthStencilView *pDepthStencilView) = 0;
            );
        [PreserveSig]
        void OMSetRenderTargetsAndUnorderedAccessViews(                                                 //virtual void STDMETHODCALLTYPE OMSetRenderTargetsAndUnorderedAccessViews(
            uint NumRTVs,                                                                               ///* [annotation] */__in  UINT NumRTVs,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11RenderTargetView[] ppRenderTargetViews,        ///* [annotation] */__in_ecount_opt(NumRTVs)  ID3D11RenderTargetView *const *ppRenderTargetViews,
            [In] ID3D11DepthStencilView pDepthStencilView,                                              ///* [annotation] */__in_opt  ID3D11DepthStencilView *pDepthStencilView,
            uint UAVStartSlot,                                                                          ///* [annotation] */__in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1 )  UINT UAVStartSlot,
            uint NumUAVs,                                                                               ///* [annotation] */__in  UINT NumUAVs,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11UnorderedAccessView[] ppUnorderedAccessViews,  ///* [annotation] */__in_ecount_opt(NumUAVs)  ID3D11UnorderedAccessView *const *ppUnorderedAccessViews,
            [In, MarshalAs(UnmanagedType.LPArray)] uint[] pUAVInitialCounts                             ///* [annotation] */__in_ecount_opt(NumUAVs)  const UINT *pUAVInitialCounts) = 0;
            );
        [PreserveSig]
        void OMSetBlendState(                                                                       //virtual void STDMETHODCALLTYPE OMSetBlendState(
            [In] ID3D11BlendState pBlendState = null,                                               ///* [annotation] */__in_opt  ID3D11BlendState *pBlendState,
            IntPtr BlendFactor = default(IntPtr),                                                   ///* [annotation] */__in_opt  const FLOAT BlendFactor[ 4 ],
            uint SampleMask = 0xffffffffU                                                           ///* [annotation] */__in  UINT SampleMask) = 0;
            );
        [PreserveSig]
        void OMSetDepthStencilState(                                                                //virtual void STDMETHODCALLTYPE OMSetDepthStencilState(
            ID3D11DepthStencilState pDepthStencilState = null,                                      ///* [annotation] */__in_opt  ID3D11DepthStencilState *pDepthStencilState,
            uint StencilRef = 0                                                                     ///* [annotation] */__in  UINT StencilRef) = 0;
            );
        [PreserveSig]
        void SOSetTargets(                                                                          //virtual void STDMETHODCALLTYPE SOSetTargets(
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_SO_BUFFER_SLOT_COUNT)  UINT NumBuffers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppSOTargets,                      ///* [annotation] */__in_ecount_opt(NumBuffers)  ID3D11Buffer *const *ppSOTargets,
            [In, MarshalAs(UnmanagedType.LPArray)] uint[] pOffsets                                  ///* [annotation] */__in_ecount_opt(NumBuffers)  const UINT *pOffsets) = 0;
            );
        [PreserveSig]
        void DrawAuto(                                                                              //virtual void STDMETHODCALLTYPE DrawAuto( void) = 0;
            );
        [PreserveSig]
        void DrawIndexedInstancedIndirect(                                                          //virtual void STDMETHODCALLTYPE DrawIndexedInstancedIndirect(
            [In] ID3D11Buffer pBufferForArgs,                                                       ///* [annotation] */__in  ID3D11Buffer *pBufferForArgs,
            uint AlignedByteOffsetForArgs                                                           ///* [annotation] */__in  UINT AlignedByteOffsetForArgs) = 0;
            );
        [PreserveSig]
        void DrawInstancedIndirect(                                                                 //virtual void STDMETHODCALLTYPE DrawInstancedIndirect(
            [In] ID3D11Buffer pBufferForArgs,                                                       ///* [annotation] */__in  ID3D11Buffer *pBufferForArgs,
            uint AlignedByteOffsetForArgs                                                           ///* [annotation] */__in  UINT AlignedByteOffsetForArgs) = 0;
            );
        [PreserveSig]
        void Dispatch(                                                                              //virtual void STDMETHODCALLTYPE Dispatch(
            uint ThreadGroupCountX,                                                                 ///* [annotation] */__in  UINT ThreadGroupCountX,
            uint ThreadGroupCountY,                                                                 ///* [annotation] */__in  UINT ThreadGroupCountY,
            uint ThreadGroupCountZ                                                                  ///* [annotation] */__in  UINT ThreadGroupCountZ) = 0;
            );
        [PreserveSig]
        void DispatchIndirect(                                                                      //virtual void STDMETHODCALLTYPE DispatchIndirect(
            [In] ID3D11Buffer pBufferForArgs,                                                       ///* [annotation] */__in  ID3D11Buffer *pBufferForArgs,
            uint AlignedByteOffsetForArgs                                                           ///* [annotation] */__in  UINT AlignedByteOffsetForArgs) = 0;
            );
        [PreserveSig]
        void RSSetState(                                                                            //virtual void STDMETHODCALLTYPE RSSetState(
            [In] ID3D11RasterizerState pRasterizerState                                             ///* [annotation] */__in_opt  ID3D11RasterizerState *pRasterizerState) = 0;
            );
        [PreserveSig]
        void RSSetViewports(                                                                        //virtual void STDMETHODCALLTYPE RSSetViewports(
            uint NumViewports,                                                                      ///* [annotation] */__in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE)  UINT NumViewports,
            IntPtr pViewports                                                                       ///* [annotation] */__in_ecount_opt(NumViewports)  const D3D11_VIEWPORT *pViewports) = 0;
            );
        [PreserveSig]
        void RSSetScissorRects(                                                                     //virtual void STDMETHODCALLTYPE RSSetScissorRects(
            uint NumRects,                                                                          ///* [annotation] */__in_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE)  UINT NumRects,
            IntPtr pRects                                                                           ///* [annotation] */__in_ecount_opt(NumRects)  const D3D11_RECT *pRects) = 0;
            );
        [PreserveSig]
        void CopySubresourceRegion(                                                                 //virtual void STDMETHODCALLTYPE CopySubresourceRegion(
            [In] ID3D11Resource pDstResource,                                                       ///* [annotation] */__in  ID3D11Resource *pDstResource,
            uint DstSubresource,                                                                    ///* [annotation] */__in  UINT DstSubresource,
            uint DstX,                                                                              ///* [annotation] */__in  UINT DstX,
            uint DstY,                                                                              ///* [annotation] */__in  UINT DstY,
            uint DstZ,                                                                              ///* [annotation] */__in  UINT DstZ,
            [In] ID3D11Resource pSrcResource,                                                       ///* [annotation] */__in  ID3D11Resource *pSrcResource,
            uint SrcSubresource,                                                                    ///* [annotation] */__in  UINT SrcSubresource,
            IntPtr pSrcBox = default(IntPtr)                                                        ///* [annotation] */__in_opt  const D3D11_BOX *pSrcBox) = 0;
            );
        [PreserveSig]
        void CopyResource(                                                                          //virtual void STDMETHODCALLTYPE CopyResource(
            [In] ID3D11Resource pDstResource,                                                       ///* [annotation] */__in  ID3D11Resource *pDstResource,
            [In] ID3D11Resource pSrcResource                                                        ///* [annotation] */__in  ID3D11Resource *pSrcResource) = 0;
            );
        [PreserveSig]
        void UpdateSubresource(                                                                     //virtual void STDMETHODCALLTYPE UpdateSubresource(
            [In] ID3D11Resource pDstResource,                                                       ///* [annotation] */__in  ID3D11Resource *pDstResource,
            uint DstSubresource,                                                                    ///* [annotation] */__in  UINT DstSubresource,
            IntPtr pDstBox,                                                                         ///* [annotation] */__in_opt  const D3D11_BOX *pDstBox,
            IntPtr pSrcData,                                                                        ///* [annotation] */__in  const void *pSrcData,
            uint SrcRowPitch,                                                                       ///* [annotation] */__in  UINT SrcRowPitch,
            uint SrcDepthPitch                                                                      ///* [annotation] */__in  UINT SrcDepthPitch) = 0;
            );
        [PreserveSig]
        void CopyStructureCount(                                                                    //virtual void STDMETHODCALLTYPE CopyStructureCount(
            [In] ID3D11Buffer pDstBuffer,                                                           ///* [annotation] */__in  ID3D11Buffer *pDstBuffer,
            uint DstAlignedByteOffset,                                                              ///* [annotation] */__in  UINT DstAlignedByteOffset,
            [In] ID3D11UnorderedAccessView pSrcView                                                 ///* [annotation] */__in  ID3D11UnorderedAccessView *pSrcView) = 0;
            );
        [PreserveSig]
        void ClearRenderTargetView(                                                                 //virtual void STDMETHODCALLTYPE ClearRenderTargetView(
            [In] ID3D11RenderTargetView pRenderTargetView,                                          ///* [annotation] */__in  ID3D11RenderTargetView *pRenderTargetView,
            IntPtr ColorRGBA                                                                        ///* [annotation] */__in  const FLOAT ColorRGBA[ 4 ]) = 0;
            );
        [PreserveSig]
        void ClearUnorderedAccessViewUint(                                                          //virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewUint(
            [In] ID3D11UnorderedAccessView pUnorderedAccessView,                                    ///* [annotation] */__in  ID3D11UnorderedAccessView *pUnorderedAccessView,
            [In, MarshalAs(UnmanagedType.LPArray)] uint[] Values                                    ///* [annotation] */__in  const UINT Values[ 4 ]) = 0;
            );
        [PreserveSig]
        void ClearUnorderedAccessViewFloat(                                                         //virtual void STDMETHODCALLTYPE ClearUnorderedAccessViewFloat(
            [In] ID3D11UnorderedAccessView pUnorderedAccessView,                                    ///* [annotation] */__in  ID3D11UnorderedAccessView *pUnorderedAccessView,
            [In, MarshalAs(UnmanagedType.LPArray)] float[] Values                                   ///* [annotation] */__in  const FLOAT Values[ 4 ]) = 0;
            );
        [PreserveSig]
        void ClearDepthStencilView(                                                                 //virtual void STDMETHODCALLTYPE ClearDepthStencilView(
            [In] ID3D11DepthStencilView pDepthStencilView,                                          ///* [annotation] */__in  ID3D11DepthStencilView *pDepthStencilView,
            uint ClearFlags,                                                                        ///* [annotation] */__in  UINT ClearFlags,
            float Depth,                                                                            ///* [annotation] */__in  FLOAT Depth,
            byte Stencil                                                                            ///* [annotation] */__in  UINT8 Stencil) = 0;
            );
        [PreserveSig]
        void GenerateMips(                                                                          //virtual void STDMETHODCALLTYPE GenerateMips(
            [In] ID3D11ShaderResourceView pShaderResourceView                                       ///* [annotation] */__in  ID3D11ShaderResourceView *pShaderResourceView) = 0;
            );
        [PreserveSig]
        void SetResourceMinLOD(                                                                     //virtual void STDMETHODCALLTYPE SetResourceMinLOD(
            [In] ID3D11Resource pResource,                                                          ///* [annotation] */__in  ID3D11Resource *pResource,
            float MinLOD                                                                            //FLOAT MinLOD) = 0;
            );
        [PreserveSig]
        float GetResourceMinLOD(                                                                    //virtual FLOAT STDMETHODCALLTYPE GetResourceMinLOD(
            [In] ID3D11Resource pResource                                                           ///* [annotation] */__in  ID3D11Resource *pResource) = 0;
            );
        [PreserveSig]
        void ResolveSubresource(                                                                    //virtual void STDMETHODCALLTYPE ResolveSubresource(
            [In] ID3D11Resource pDstResource,                                                       ///* [annotation] */__in  ID3D11Resource *pDstResource,
            uint DstSubresource,                                                                    ///* [annotation] */__in  UINT DstSubresource,
            [In] ID3D11Resource pSrcResource,                                                       ///* [annotation] */__in  ID3D11Resource *pSrcResource,
            uint SrcSubresource,                                                                    ///* [annotation] */__in  UINT SrcSubresource,
            DXGI_FORMAT Format                                                                      ///* [annotation] */__in  DXGI_FORMAT Format) = 0;
            );
        [PreserveSig]
        void ExecuteCommandList(                                                                    //virtual void STDMETHODCALLTYPE ExecuteCommandList(
            [In] ID3D11CommandList pCommandList,                                                    ///* [annotation] */__in  ID3D11CommandList *pCommandList,
            int RestoreContextState                                                                 //BOOL RestoreContextState) = 0;
            );
        [PreserveSig]
        void HSSetShaderResources(                                                                  //virtual void STDMETHODCALLTYPE HSSetShaderResources(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumViews,                                                                          ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumViews,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11ShaderResourceView[] ppShaderResourceViews ///* [annotation] */__in_ecount(NumViews)  ID3D11ShaderResourceView *const *ppShaderResourceViews) = 0;
            );
        [PreserveSig]
        void HSSetShader(                                                                           //virtual void STDMETHODCALLTYPE HSSetShader(
            [In] ID3D11HullShader pHullShader,                                                      ///* [annotation] */__in_opt  ID3D11HullShader *pHullShader,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11ClassInstance[] ppClassInstances,          ///* [annotation] */__in_ecount_opt(NumClassInstances)  ID3D11ClassInstance *const *ppClassInstances,
            uint NumClassInstances                                                                  //UINT NumClassInstances) = 0;
            );
        [PreserveSig]
        void HSSetSamplers(                                                                         //virtual void STDMETHODCALLTYPE HSSetSamplers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumSamplers,                                                                       ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )  UINT NumSamplers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11SamplerState[] ppSamplers                  ///* [annotation] */__in_ecount(NumSamplers)  ID3D11SamplerState *const *ppSamplers) = 0;
            );
        [PreserveSig]
        void HSSetConstantBuffers(                                                                  //virtual void STDMETHODCALLTYPE HSSetConstantBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppConstantBuffers                 ///* [annotation] */__in_ecount(NumBuffers)  ID3D11Buffer *const *ppConstantBuffers) = 0;
            );
        [PreserveSig]
        void DSSetShaderResources(                                                                  //virtual void STDMETHODCALLTYPE DSSetShaderResources(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumViews,                                                                          ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumViews,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11ShaderResourceView[] ppShaderResourceViews ///* [annotation] */__in_ecount(NumViews)  ID3D11ShaderResourceView *const *ppShaderResourceViews) = 0;
            );
        [PreserveSig]
        void DSSetShader(                                                                           //virtual void STDMETHODCALLTYPE DSSetShader(
            [In] ID3D11DomainShader pDomainShader,                                                  ///* [annotation] */__in_opt  ID3D11DomainShader *pDomainShader,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11ClassInstance[] ppClassInstances,          ///* [annotation] */__in_ecount_opt(NumClassInstances)  ID3D11ClassInstance *const *ppClassInstances,
            uint NumClassInstances                                                                  //UINT NumClassInstances) = 0;
            );
        [PreserveSig]
        void DSSetSamplers(                                                                         //virtual void STDMETHODCALLTYPE DSSetSamplers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumSamplers,                                                                       ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )  UINT NumSamplers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11SamplerState[] ppSamplers                  ///* [annotation] */__in_ecount(NumSamplers)  ID3D11SamplerState *const *ppSamplers) = 0;
            );
        [PreserveSig]
        void DSSetConstantBuffers(                                                                  //virtual void STDMETHODCALLTYPE DSSetConstantBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppConstantBuffers                 ///* [annotation] */__in_ecount(NumBuffers)  ID3D11Buffer *const *ppConstantBuffers) = 0;
            );
        [PreserveSig]
        void CSSetShaderResources(                                                                  //virtual void STDMETHODCALLTYPE CSSetShaderResources(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumViews,                                                                          ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumViews,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11ShaderResourceView[] ppShaderResourceViews ///* [annotation] */__in_ecount(NumViews)  ID3D11ShaderResourceView *const *ppShaderResourceViews) = 0;
            );
        [PreserveSig]
        void CSSetUnorderedAccessViews(                                                                 //virtual void STDMETHODCALLTYPE CSSetUnorderedAccessViews(
            uint StartSlot,                                                                             ///* [annotation] */__in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1 )  UINT StartSlot,
            uint NumUAVs,                                                                               ///* [annotation] */__in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot )  UINT NumUAVs,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11UnorderedAccessView[] ppUnorderedAccessViews,  ///* [annotation] */__in_ecount(NumUAVs)  ID3D11UnorderedAccessView *const *ppUnorderedAccessViews,
            [In, MarshalAs(UnmanagedType.LPArray)] uint[] pUAVInitialCounts                             ///* [annotation] */__in_ecount(NumUAVs)  const UINT *pUAVInitialCounts) = 0;
            );
        [PreserveSig]
        void CSSetShader(                                                                           //virtual void STDMETHODCALLTYPE CSSetShader(
            ID3D11ComputeShader pComputeShader,                                                     ///* [annotation] */__in_opt  ID3D11ComputeShader *pComputeShader,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11ClassInstance[] ppClassInstances,          ///* [annotation] */__in_ecount_opt(NumClassInstances)  ID3D11ClassInstance *const *ppClassInstances,
            uint NumClassInstances                                                                  //UINT NumClassInstances) = 0;
            );
        [PreserveSig]
        void CSSetSamplers(                                                                         //virtual void STDMETHODCALLTYPE CSSetSamplers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumSamplers,                                                                       ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )  UINT NumSamplers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11SamplerState[] ppSamplers                  ///* [annotation] */__in_ecount(NumSamplers)  ID3D11SamplerState *const *ppSamplers) = 0;
            );
        [PreserveSig]
        void CSSetConstantBuffers(                                                                  //virtual void STDMETHODCALLTYPE CSSetConstantBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [In, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppConstantBuffers                 ///* [annotation] */__in_ecount(NumBuffers)  ID3D11Buffer *const *ppConstantBuffers) = 0;
            );
        [PreserveSig]
        void VSGetConstantBuffers(                                                                  //virtual void STDMETHODCALLTYPE VSGetConstantBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppConstantBuffers                ///* [annotation] */__out_ecount(NumBuffers)  ID3D11Buffer **ppConstantBuffers) = 0;
            );
        [PreserveSig]
        void PSGetShaderResources(                                                                      //virtual void STDMETHODCALLTYPE PSGetShaderResources(
            uint StartSlot,                                                                             ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumViews,                                                                              ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumViews,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11ShaderResourceView[] ppShaderResourceViews    ///* [annotation] */__out_ecount(NumViews)  ID3D11ShaderResourceView **ppShaderResourceViews) = 0;
            );
        [PreserveSig]
        void PSGetShader(                                                                           //virtual void STDMETHODCALLTYPE PSGetShader(
            [Out] out ID3D11PixelShader ppPixelShader,                                              ///* [annotation] */__out  ID3D11PixelShader **ppPixelShader,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11ClassInstance[] ppClassInstances = null,  ///* [annotation] */__out_ecount_opt(*pNumClassInstances)  ID3D11ClassInstance **ppClassInstances,
            [In, Out] LP_UInt32 pNumClassInstances = null                                           ///* [annotation] */__inout_opt  UINT *pNumClassInstances) = 0;
            );
        [PreserveSig]
        void PSGetSamplers(                                                                         //virtual void STDMETHODCALLTYPE PSGetSamplers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumSamplers,                                                                       ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )  UINT NumSamplers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11SamplerState[] ppSamplers                 ///* [annotation] */__out_ecount(NumSamplers)  ID3D11SamplerState **ppSamplers) = 0;
            );
        [PreserveSig]
        void VSGetShader(                                                                           //virtual void STDMETHODCALLTYPE VSGetShader(
            [Out] out ID3D11VertexShader ppVertexShader,                                            ///* [annotation] */__out  ID3D11VertexShader **ppVertexShader,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11ClassInstance[] ppClassInstances = null,  ///* [annotation] */__out_ecount_opt(*pNumClassInstances)  ID3D11ClassInstance **ppClassInstances,
            [In, Out] LP_UInt32 pNumClassInstances = null                                           ///* [annotation] */__inout_opt  UINT *pNumClassInstances) = 0;
            );
        [PreserveSig]
        void PSGetConstantBuffers(                                                                  //virtual void STDMETHODCALLTYPE PSGetConstantBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppConstantBuffers                ///* [annotation] */__out_ecount(NumBuffers)  ID3D11Buffer **ppConstantBuffers) = 0;
            );
        [PreserveSig]
        void IAGetInputLayout(                                                                      //virtual void STDMETHODCALLTYPE IAGetInputLayout(
            [Out] out ID3D11InputLayout ppInputLayout                                               ///* [annotation] */__out  ID3D11InputLayout **ppInputLayout) = 0;
            );
        [PreserveSig]
        void IAGetVertexBuffers(                                                                    //virtual void STDMETHODCALLTYPE IAGetVertexBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppVertexBuffers,                 ///* [annotation] */__out_ecount_opt(NumBuffers)  ID3D11Buffer **ppVertexBuffers,
            [Out, MarshalAs(UnmanagedType.LPArray)] uint[] pStrides = null,                         ///* [annotation] */__out_ecount_opt(NumBuffers)  UINT *pStrides,
            [Out, MarshalAs(UnmanagedType.LPArray)] uint[] pOffsets = null                          ///* [annotation] */__out_ecount_opt(NumBuffers)  UINT *pOffsets) = 0;
            );
        [PreserveSig]
        void IAGetIndexBuffer(                                                                      //virtual void STDMETHODCALLTYPE IAGetIndexBuffer(
            [Out] out ID3D11Buffer pIndexBuffer,                                                    ///* [annotation] */__out_opt  ID3D11Buffer **pIndexBuffer,
            [Out] out DXGI_FORMAT Format,                                                           ///* [annotation] */__out_opt  DXGI_FORMAT *Format,
            [Out] LP_UInt32 Offset = null                                                           ///* [annotation] */__out_opt  UINT *Offset) = 0;
            );
        [PreserveSig]
        void GSGetConstantBuffers(                                                                  //virtual void STDMETHODCALLTYPE GSGetConstantBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppConstantBuffers                ///* [annotation] */__out_ecount(NumBuffers)  ID3D11Buffer **ppConstantBuffers) = 0;
            );
        [PreserveSig]
        void GSGetShader(                                                                           //virtual void STDMETHODCALLTYPE GSGetShader(
            [Out] out ID3D11GeometryShader ppGeometryShader,                                        ///* [annotation] */__out  ID3D11GeometryShader **ppGeometryShader,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11ClassInstance[] ppClassInstances = null,  ///* [annotation] */__out_ecount_opt(*pNumClassInstances)  ID3D11ClassInstance **ppClassInstances,
            [In, Out] LP_UInt32 pNumClassInstances = null                                           ///* [annotation] */__inout_opt  UINT *pNumClassInstances) = 0;
            );
        [PreserveSig]
        void IAGetPrimitiveTopology(                                                                //virtual void STDMETHODCALLTYPE IAGetPrimitiveTopology(
            [Out] out D3D11_PRIMITIVE_TOPOLOGY pTopology                                            ///* [annotation] */__out  D3D11_PRIMITIVE_TOPOLOGY *pTopology) = 0;
            );
        [PreserveSig]
        void VSGetShaderResources(                                                                      //virtual void STDMETHODCALLTYPE VSGetShaderResources(
            uint StartSlot,                                                                             ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumViews,                                                                              ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumViews,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11ShaderResourceView[] ppShaderResourceViews    ///* [annotation] */__out_ecount(NumViews)  ID3D11ShaderResourceView **ppShaderResourceViews) = 0;
            );
        [PreserveSig]
        void VSGetSamplers(                                                                         //virtual void STDMETHODCALLTYPE VSGetSamplers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumSamplers,                                                                       ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )  UINT NumSamplers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11SamplerState[] ppSamplers                 ///* [annotation] */__out_ecount(NumSamplers)  ID3D11SamplerState **ppSamplers) = 0;
            );
        [PreserveSig]
        void GetPredication(                                                                        //virtual void STDMETHODCALLTYPE GetPredication(
            [Out] out ID3D11Predicate ppPredicate,                                                  ///* [annotation] */__out_opt  ID3D11Predicate **ppPredicate,
            [Out] LP_UInt32 pPredicateValue = null                                                  ///* [annotation] */__out_opt  BOOL *pPredicateValue) = 0;
            );
        [PreserveSig]
        void GSGetShaderResources(                                                                      //virtual void STDMETHODCALLTYPE GSGetShaderResources(
            uint StartSlot,                                                                             ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumViews,                                                                              ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumViews,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11ShaderResourceView[] ppShaderResourceViews    ///* [annotation] */__out_ecount(NumViews)  ID3D11ShaderResourceView **ppShaderResourceViews) = 0;
            );
        [PreserveSig]
        void GSGetSamplers(                                                                         //virtual void STDMETHODCALLTYPE GSGetSamplers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumSamplers,                                                                       ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )  UINT NumSamplers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11SamplerState[] ppSamplers                 ///* [annotation] */__out_ecount(NumSamplers)  ID3D11SamplerState **ppSamplers) = 0;
            );
        [PreserveSig]
        void OMGetRenderTargets(                                                                    //virtual void STDMETHODCALLTYPE OMGetRenderTargets(
            uint NumViews,                                                                          ///* [annotation] */__in_range( 0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT )  UINT NumViews,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11RenderTargetView[] ppRenderTargetViews,   ///* [annotation] */__out_ecount_opt(NumViews)  ID3D11RenderTargetView **ppRenderTargetViews,
            [Out] LP_ID3D11DepthStencilView ppDepthStencilView = null                               ///* [annotation] */__out_opt  ID3D11DepthStencilView **ppDepthStencilView) = 0;
            );
        [PreserveSig]
        void OMGetRenderTargetsAndUnorderedAccessViews(                                                         //virtual void STDMETHODCALLTYPE OMGetRenderTargetsAndUnorderedAccessViews(
            uint NumRTVs,                                                                                       ///* [annotation] */__in_range( 0, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT )  UINT NumRTVs,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11RenderTargetView[] ppRenderTargetViews,               ///* [annotation] */__out_ecount_opt(NumRTVs)  ID3D11RenderTargetView **ppRenderTargetViews,
            [Out] LP_ID3D11DepthStencilView ppDepthStencilView = null,                                          ///* [annotation] */__out_opt  ID3D11DepthStencilView **ppDepthStencilView,
            uint UAVStartSlot = 0,                                                                              ///* [annotation] */__in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1 )  UINT UAVStartSlot,
            uint NumUAVs = 0,                                                                                   ///* [annotation] */__in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - UAVStartSlot )  UINT NumUAVs,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11UnorderedAccessView[] ppUnorderedAccessViews = null   ///* [annotation] */__out_ecount_opt(NumUAVs)  ID3D11UnorderedAccessView **ppUnorderedAccessViews) = 0;
            );
        [PreserveSig]
        void OMGetBlendState(                                                                       //virtual void STDMETHODCALLTYPE OMGetBlendState(
            [Out] LP_ID3D11BlendState ppBlendState = null,                                          ///* [annotation] */__out_opt  ID3D11BlendState **ppBlendState,
            [Out, MarshalAs(UnmanagedType.LPArray)] float[] BlendFactor = null,                     ///* [annotation] */__out_opt  FLOAT BlendFactor[ 4 ],
            [Out] LP_UInt32 pSampleMask = null                                                      ///* [annotation] */__out_opt  UINT *pSampleMask) = 0;
            );
        [PreserveSig]
        void OMGetDepthStencilState(                                                                //virtual void STDMETHODCALLTYPE OMGetDepthStencilState(
            [Out] LP_ID3D11DepthStencilState ppDepthStencilState = null,                            ///* [annotation] */__out_opt  ID3D11DepthStencilState **ppDepthStencilState,
            [Out] LP_UInt32 pStencilRef = null                                                      ///* [annotation] */__out_opt  UINT *pStencilRef) = 0;
            );
        [PreserveSig]
        void SOGetTargets(                                                                          //virtual void STDMETHODCALLTYPE SOGetTargets(
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_SO_BUFFER_SLOT_COUNT )  UINT NumBuffers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppSOTargets                      ///* [annotation] */__out_ecount(NumBuffers)  ID3D11Buffer **ppSOTargets) = 0;
            );
        [PreserveSig]
        void RSGetState(                                                                            //virtual void STDMETHODCALLTYPE RSGetState(
            [Out] out ID3D11RasterizerState ppRasterizerState                                       ///* [annotation] */__out  ID3D11RasterizerState **ppRasterizerState) = 0;
            );
        [PreserveSig]
        void RSGetViewports(                                                                        //virtual void STDMETHODCALLTYPE RSGetViewports(
            [In, Out] LP_UInt32 pNumViewports,                                                      ///* [annotation] */__inout /*_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/   UINT *pNumViewports,
            IntPtr pViewports                                                                       ///* [annotation] */__out_ecount_opt(*pNumViewports)  D3D11_VIEWPORT *pViewports) = 0;
            );
        [PreserveSig]
        void RSGetScissorRects(                                                                     //virtual void STDMETHODCALLTYPE RSGetScissorRects(
            [In, Out] LP_UInt32 pNumRects,                                                          ///* [annotation] */__inout /*_range(0, D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE )*/   UINT *pNumRects,
            IntPtr pRects                                                                           ///* [annotation] */__out_ecount_opt(*pNumRects)  D3D11_RECT *pRects) = 0;
            );
        [PreserveSig]
        void HSGetShaderResources(                                                                      //virtual void STDMETHODCALLTYPE HSGetShaderResources(
            uint StartSlot,                                                                             ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumViews,                                                                              ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumViews,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11ShaderResourceView[] ppShaderResourceViews    ///* [annotation] */__out_ecount(NumViews)  ID3D11ShaderResourceView **ppShaderResourceViews) = 0;
            );
        [PreserveSig]
        void HSGetShader(                                                                           //virtual void STDMETHODCALLTYPE HSGetShader(
            [Out] out ID3D11HullShader ppHullShader,                                                ///* [annotation] */__out  ID3D11HullShader **ppHullShader,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11ClassInstance[] ppClassInstances = null,  ///* [annotation] */__out_ecount_opt(*pNumClassInstances)  ID3D11ClassInstance **ppClassInstances,
            [In, Out] LP_UInt32 pNumClassInstances = null                                           ///* [annotation] */__inout_opt  UINT *pNumClassInstances) = 0;
            );
        [PreserveSig]
        void HSGetSamplers(                                                                         //virtual void STDMETHODCALLTYPE HSGetSamplers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumSamplers,                                                                       ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )  UINT NumSamplers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11SamplerState[] ppSamplers                 ///* [annotation] */__out_ecount(NumSamplers)  ID3D11SamplerState **ppSamplers) = 0;
            );
        [PreserveSig]
        void HSGetConstantBuffers(                                                                  //virtual void STDMETHODCALLTYPE HSGetConstantBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppConstantBuffers                ///* [annotation] */__out_ecount(NumBuffers)  ID3D11Buffer **ppConstantBuffers) = 0;
            );
        [PreserveSig]
        void DSGetShaderResources(                                                                      //virtual void STDMETHODCALLTYPE DSGetShaderResources(
            uint StartSlot,                                                                             ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumViews,                                                                              ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumViews,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11ShaderResourceView[] ppShaderResourceViews    ///* [annotation] */__out_ecount(NumViews)  ID3D11ShaderResourceView **ppShaderResourceViews) = 0;
            );
        [PreserveSig]
        void DSGetShader(                                                                           //virtual void STDMETHODCALLTYPE DSGetShader(
            [Out] out ID3D11DomainShader ppDomainShader,                                            ///* [annotation] */__out  ID3D11DomainShader **ppDomainShader,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11ClassInstance[] ppClassInstances = null,  ///* [annotation] */__out_ecount_opt(*pNumClassInstances)  ID3D11ClassInstance **ppClassInstances,
            [In, Out] LP_UInt32 pNumClassInstances = null                                           ///* [annotation] */__inout_opt  UINT *pNumClassInstances) = 0;
            );
        [PreserveSig]
        void DSGetSamplers(                                                                         //virtual void STDMETHODCALLTYPE DSGetSamplers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumSamplers,                                                                       ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )  UINT NumSamplers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11SamplerState[] ppSamplers                 ///* [annotation] */__out_ecount(NumSamplers)  ID3D11SamplerState **ppSamplers) = 0;
            );
        [PreserveSig]
        void DSGetConstantBuffers(                                                                  //virtual void STDMETHODCALLTYPE DSGetConstantBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppConstantBuffers                ///* [annotation] */__out_ecount(NumBuffers)  ID3D11Buffer **ppConstantBuffers) = 0;
            );
        [PreserveSig]
        void CSGetShaderResources(                                                                      //virtual void STDMETHODCALLTYPE CSGetShaderResources(
            uint StartSlot,                                                                             ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumViews,                                                                              ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot )  UINT NumViews,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11ShaderResourceView[] ppShaderResourceViews    ///* [annotation] */__out_ecount(NumViews)  ID3D11ShaderResourceView **ppShaderResourceViews) = 0;
            );
        [PreserveSig]
        void CSGetUnorderedAccessViews(                                                                 //virtual void STDMETHODCALLTYPE CSGetUnorderedAccessViews(
            uint StartSlot,                                                                             ///* [annotation] */__in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - 1 )  UINT StartSlot,
            uint NumUAVs,                                                                               ///* [annotation] */__in_range( 0, D3D11_PS_CS_UAV_REGISTER_COUNT - StartSlot )  UINT NumUAVs,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11UnorderedAccessView[] ppUnorderedAccessViews  ///* [annotation] */__out_ecount(NumUAVs)  ID3D11UnorderedAccessView **ppUnorderedAccessViews) = 0;
            );
        [PreserveSig]
        void CSGetShader(                                                                           //virtual void STDMETHODCALLTYPE CSGetShader(
            [Out] out ID3D11ComputeShader ppComputeShader,                                          ///* [annotation] */__out  ID3D11ComputeShader **ppComputeShader,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11ClassInstance[] ppClassInstances = null,  ///* [annotation] */__out_ecount_opt(*pNumClassInstances)  ID3D11ClassInstance **ppClassInstances,
            [In, Out] LP_UInt32 pNumClassInstances = null                                           ///* [annotation] */__inout_opt  UINT *pNumClassInstances) = 0;
            );
        [PreserveSig]
        void CSGetSamplers(                                                                         //virtual void STDMETHODCALLTYPE CSGetSamplers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumSamplers,                                                                       ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT - StartSlot )  UINT NumSamplers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11SamplerState[] ppSamplers                 ///* [annotation] */__out_ecount(NumSamplers)  ID3D11SamplerState **ppSamplers) = 0;
            );
        [PreserveSig]
        void CSGetConstantBuffers(                                                                  //virtual void STDMETHODCALLTYPE CSGetConstantBuffers(
            uint StartSlot,                                                                         ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1 )  UINT StartSlot,
            uint NumBuffers,                                                                        ///* [annotation] */__in_range( 0, D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot )  UINT NumBuffers,
            [Out, MarshalAs(UnmanagedType.LPArray)] ID3D11Buffer[] ppConstantBuffers                ///* [annotation] */__out_ecount(NumBuffers)  ID3D11Buffer **ppConstantBuffers) = 0;
            );
        [PreserveSig]
        void ClearState(                                                                            //virtual void STDMETHODCALLTYPE ClearState( void) = 0;
            );
        [PreserveSig]
        void Flush(                                                                                 //virtual void STDMETHODCALLTYPE Flush( void) = 0;
            );
        [PreserveSig]
        D3D11_DEVICE_CONTEXT_TYPE GetType(                                                          //virtual D3D11_DEVICE_CONTEXT_TYPE STDMETHODCALLTYPE GetType( void) = 0;
            );
        [PreserveSig]
        uint GetContextFlags(                                                                       //virtual UINT STDMETHODCALLTYPE GetContextFlags( void) = 0;
            );
        void FinishCommandList(                                                                     //virtual HRESULT STDMETHODCALLTYPE FinishCommandList(
            int RestoreDeferredContextState,                                                        //BOOL RestoreDeferredContextState,
            [Out] out ID3D11CommandList ppCommandList                                               ///* [annotation] */__out_opt  ID3D11CommandList **ppCommandList) = 0;
            );
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_ID3D11DeviceContext : LP_IUnknown<ID3D11DeviceContext> { }
    #endregion
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("839d1216-bb2e-412b-b7f4-a9dbebe08ed1"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11View : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetResource(                                                       //virtual void STDMETHODCALLTYPE GetResource(
            [Out] out ID3D11Resource ppResource                                 ///* [annotation] */__out  ID3D11Resource **ppResource) = 0;
            );
    }
    #region ID3D11ShaderResourceView
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("b0e06fe0-8192-4e1a-b1ca-36d7414710b2"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11ShaderResourceView : ID3D11View
    {
        #region inherit ID3D11View
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetResource(                                                       //virtual void STDMETHODCALLTYPE GetResource(
            [Out] out ID3D11Resource ppResource                                 ///* [annotation] */__out  ID3D11Resource **ppResource) = 0;
            );
        #endregion
        [PreserveSig]
        void GetDesc(                                                           //virtual void STDMETHODCALLTYPE GetDesc(
            [Out] out D3D11_SHADER_RESOURCE_VIEW_DESC pDesc                     ///* [annotation] */__out  D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc) = 0;
            );
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_ID3D11ShaderResourceView : LP_IUnknown<ID3D11ShaderResourceView> { }
    #endregion
    #region ID3D11RenderTargetView
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("dfdba067-0b8d-4865-875b-d7b4516cc164"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11RenderTargetView : ID3D11View
    {
        #region inherit ID3D11View
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetResource(                                                       //virtual void STDMETHODCALLTYPE GetResource(
            [Out] out ID3D11Resource ppResource                                 ///* [annotation] */__out  ID3D11Resource **ppResource) = 0;
            );
        #endregion
        [PreserveSig]
        void GetDesc(                                                           //virtual void STDMETHODCALLTYPE GetDesc(
            [Out] out D3D11_RENDER_TARGET_VIEW_DESC pDesc                       ///* [annotation] */__out  D3D11_RENDER_TARGET_VIEW_DESC *pDesc) = 0;
            );
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_ID3D11RenderTargetView : LP_IUnknown<ID3D11RenderTargetView> { }
    #endregion
    #region ID3D11UnorderedAccessView
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("28acf509-7f5c-48f6-8611-f316010a6380"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11UnorderedAccessView : ID3D11View
    {
        #region inherit ID3D11View
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetResource(                                                       //virtual void STDMETHODCALLTYPE GetResource(
            [Out] out ID3D11Resource ppResource                                 ///* [annotation] */__out  ID3D11Resource **ppResource) = 0;
            );
        #endregion
        [PreserveSig]
        void GetDesc(                                                           //virtual void STDMETHODCALLTYPE GetDesc(
            [Out] out D3D11_UNORDERED_ACCESS_VIEW_DESC pDesc                    ///* [annotation] */__out  D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc) = 0;
            );
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_ID3D11UnorderedAccessView : LP_IUnknown<ID3D11UnorderedAccessView> { }
    #endregion
    #region ID3D11DepthStencilView
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("9fdac92a-1876-48c3-afad-25b94f84a9b6"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11DepthStencilView : ID3D11View
    {
        #region inherit ID3D11View
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetResource(                                                       //virtual void STDMETHODCALLTYPE GetResource(
            [Out] out ID3D11Resource ppResource                                 ///* [annotation] */__out  ID3D11Resource **ppResource) = 0;
            );
        #endregion
        [PreserveSig]
        void GetDesc(                                                           //virtual void STDMETHODCALLTYPE GetDesc(
            [Out] out D3D11_DEPTH_STENCIL_VIEW_DESC pDesc                       ///* [annotation] */__out  D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc) = 0;
            );
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_ID3D11DepthStencilView : LP_IUnknown<ID3D11DepthStencilView> { }
    #endregion
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("8BA5FB08-5195-40e2-AC58-0D989C3A0102"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D10Blob
    {
        [PreserveSig]
        IntPtr GetBufferPointer(                                        //virtual LPVOID STDMETHODCALLTYPE GetBufferPointer( void) = 0;
            );
        [PreserveSig]
        IntPtr GetBufferSize(                                           //virtual SIZE_T STDMETHODCALLTYPE GetBufferSize( void) = 0;
            );
    }
    #region ID3D11InputLayout
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("e4819ddc-4cf0-4025-bd26-5de82a3e07b7"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11InputLayout : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_ID3D11InputLayout : LP_IUnknown<ID3D11InputLayout> { }
    #endregion
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("ddf57cba-9543-46e4-a12b-f207a0fe7fed"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11ClassLinkage : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        void GetClassInstance(                                                  //virtual HRESULT STDMETHODCALLTYPE GetClassInstance( 
            [In, MarshalAs(UnmanagedType.LPStr)] string pClassInstanceName,     ///* [annotation] */__in  LPCSTR pClassInstanceName,
            uint InstanceIndex,                                                 ///* [annotation] */__in  UINT InstanceIndex,
            [Out] out ID3D11ClassInstance ppInstance                            ///* [annotation] */__out  ID3D11ClassInstance **ppInstance) = 0;
            );
        void CreateClassInstance(                                               //virtual HRESULT STDMETHODCALLTYPE CreateClassInstance( 
            [In, MarshalAs(UnmanagedType.LPStr)] string pClassTypeName,         ///* [annotation] */__in  LPCSTR pClassTypeName,
            uint ConstantBufferOffset,                                          ///* [annotation] */__in  UINT ConstantBufferOffset,
            uint ConstantVectorOffset,                                          ///* [annotation] */__in  UINT ConstantVectorOffset,
            uint TextureOffset,                                                 ///* [annotation] */__in  UINT TextureOffset,
            uint SamplerOffset,                                                 ///* [annotation] */__in  UINT SamplerOffset,
            [Out] out ID3D11ClassInstance ppInstance                            ///* [annotation] */__out  ID3D11ClassInstance **ppInstance) = 0;
            );
    }
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("a6cd7faa-b0b7-4a2f-9436-8662a65797cb"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11ClassInstance : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetClassLinkage(                                                   //virtual void STDMETHODCALLTYPE GetClassLinkage( 
            [Out] out ID3D11ClassLinkage ppLinkage                              ///* [annotation] */__out  ID3D11ClassLinkage **ppLinkage) = 0;
            );
        [PreserveSig]
        void GetDesc(                                                           //virtual void STDMETHODCALLTYPE GetDesc( 
            [Out] out D3D11_CLASS_INSTANCE_DESC pDesc                           ///* [annotation] */__out  D3D11_CLASS_INSTANCE_DESC *pDesc) = 0;
            );
        [PreserveSig]
        void GetInstanceName(                                                   //virtual void STDMETHODCALLTYPE GetInstanceName( 
            [Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder pInstanceName,  ///* [annotation] */__out_ecount_opt(*pBufferLength)  LPSTR pInstanceName,
            [In, Out] ref IntPtr pBufferLength                                  ///* [annotation] */__inout  SIZE_T *pBufferLength) = 0;
            );
        [PreserveSig]
        void GetTypeName(                                                       //virtual void STDMETHODCALLTYPE GetTypeName( 
            [Out, MarshalAs(UnmanagedType.LPStr)] StringBuilder pTypeName,      ///* [annotation] */__out_ecount_opt(*pBufferLength)  LPSTR pTypeName,
            [In, Out] ref IntPtr pBufferLength                                  ///* [annotation] */__inout  SIZE_T *pBufferLength) = 0;
            );
    }
    #region ID3D11VertexShader
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("3b301d64-d678-4289-8897-22f8928b72f3"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11VertexShader : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
    }
    public class LP_ID3D11VertexShader : LP_IUnknown<ID3D11VertexShader> { }
    #endregion
    #region ID3D11GeometryShader
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("38325b96-effb-4022-ba02-2e795b70275c"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11GeometryShader : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
    }
    public class LP_ID3D11GeometryShader : LP_IUnknown<ID3D11GeometryShader> { }
    #endregion
    #region ID3D11PixelShader
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("ea82e40d-51dc-4f33-93d4-db7c9125ae8c"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11PixelShader : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
    }
    public class LP_ID3D11PixelShader : LP_IUnknown<ID3D11PixelShader> { }
    #endregion
    #region ID3D11HullShader
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("8e5c6061-628a-4c8e-8264-bbe45cb3d5dd"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11HullShader : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
    }
    public class LP_ID3D11HullShader : LP_IUnknown<ID3D11HullShader> { }
    #endregion
    #region ID3D11DomainShader
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("f582c508-0f36-490c-9977-31eece268cfa"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11DomainShader : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
    }
    public class LP_ID3D11DomainShader : LP_IUnknown<ID3D11DomainShader> { }
    #endregion
    #region ID3D11ComputeShader
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("4f5b196e-c2bd-495e-bd01-1fded38e4969"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11ComputeShader : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
    }
    public class LP_ID3D11ComputeShader : LP_IUnknown<ID3D11ComputeShader> { }
    #endregion
    #region ID3D11BlendState
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("75b68faa-347d-4159-8f45-a0640f01cd9a"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11BlendState : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetDesc(                                       //virtual void STDMETHODCALLTYPE GetDesc( 
            [Out] out D3D11_BLEND_DESC pDesc                ///* [annotation] */__out  D3D11_BLEND_DESC *pDesc) = 0;
            );
    }
    public class LP_ID3D11BlendState : LP_IUnknown<ID3D11BlendState> { }
    #endregion
    #region ID3D11DepthStencilState
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("03823efb-8d8f-4e1c-9aa2-f64bb2cbfdf1"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11DepthStencilState : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetDesc(                                       //virtual void STDMETHODCALLTYPE GetDesc(
            [Out] out D3D11_DEPTH_STENCIL_DESC pDesc        ///* [annotation] */__out  D3D11_DEPTH_STENCIL_DESC *pDesc) = 0;
            );
    }
    public class LP_ID3D11DepthStencilState : LP_IUnknown<ID3D11DepthStencilState> { }
    #endregion
    #region ID3D11RasterizerState
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("9bb4ab81-ab1a-4d8f-b506-fc04200b6ee7"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11RasterizerState : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetDesc(                                       //virtual void STDMETHODCALLTYPE GetDesc(
            [Out] out D3D11_RASTERIZER_DESC pDesc           ///* [annotation] */__out  D3D11_RASTERIZER_DESC *pDesc) = 0;
            );
    }
    public class LP_ID3D11RasterizerState : LP_IUnknown<ID3D11RasterizerState> { }
    #endregion
    #region ID3D11SamplerState
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("da6fea51-564c-4487-9810-f0d0f9b4e3a5"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11SamplerState : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        void GetDesc(                                       //virtual void STDMETHODCALLTYPE GetDesc(
            [Out] out D3D11_SAMPLER_DESC pDesc              ///* [annotation] */__out  D3D11_SAMPLER_DESC *pDesc) = 0;
            );
    }
    public class LP_ID3D11SamplerState : LP_IUnknown<ID3D11SamplerState> { }
    #endregion
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("4b35d0cd-1e15-4258-9c98-1b1333f6dd3b"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11Asynchronous : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        uint GetDataSize(                                   //virtual UINT STDMETHODCALLTYPE GetDataSize( void) = 0;
            );
    }
    #region ID3D11Query
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("d6c00747-87b7-425e-b84d-44d108560afd"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11Query : ID3D11Asynchronous
    {
        #region inherit ID3D11Asynchronous
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        uint GetDataSize(                                   //virtual UINT STDMETHODCALLTYPE GetDataSize( void) = 0;
            );
        #endregion
        [PreserveSig]
        void GetDesc(                                       //virtual void STDMETHODCALLTYPE GetDesc(
            [Out] out D3D11_QUERY_DESC pDesc                ///* [annotation] */__out  D3D11_QUERY_DESC *pDesc) = 0;
            );
    }
    public class LP_ID3D11Query : LP_IUnknown<ID3D11Query> { }
    #endregion
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("9eb576dd-9f77-4d86-81aa-8bab5fe490e2"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11Predicate : ID3D11Query
    {
        #region inherit ID3D11Query
        #region inherit ID3D11Asynchronous
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        uint GetDataSize(                                   //virtual UINT STDMETHODCALLTYPE GetDataSize( void) = 0;
            );
        #endregion
        [PreserveSig]
        void GetDesc(                                       //virtual void STDMETHODCALLTYPE GetDesc(
            [Out] out D3D11_QUERY_DESC pDesc                ///* [annotation] */__out  D3D11_QUERY_DESC *pDesc) = 0;
            );
        #endregion
    }
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("6e8c49fb-a371-4770-b440-29086022b741"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11Counter : ID3D11Asynchronous
    {
        #region inherit ID3D11Asynchronous
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        uint GetDataSize(                                   //virtual UINT STDMETHODCALLTYPE GetDataSize( void) = 0;
            );
        #endregion
        [PreserveSig]
        void GetDesc(                                       //virtual void STDMETHODCALLTYPE GetDesc(
            [Out] out D3D11_COUNTER_DESC pDesc              ///* [annotation] */__out  D3D11_COUNTER_DESC *pDesc) = 0;
            );
    }
    [ComImport, System.Security.SuppressUnmanagedCodeSecurity,
    Guid("a24bc4d1-769e-43f7-8013-98ff566c18e2"),
    InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface ID3D11CommandList : ID3D11DeviceChild
    {
        #region inherit ID3D11DeviceChild
        [PreserveSig]
        void GetDevice(                                                         //virtual void STDMETHODCALLTYPE GetDevice(
            [Out] out ID3D11Device ppDevice                                     ///* [annotation] */__out  ID3D11Device **ppDevice) = 0;
            );
        void GetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE GetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [In, Out] ref uint pDataSize,                                       ///* [annotation] */__inout  UINT *pDataSize,
            IntPtr pData                                                        ///* [annotation] */__out_bcount_opt( *pDataSize )  void *pData) = 0;
            );
        void SetPrivateData(                                                    //virtual HRESULT STDMETHODCALLTYPE SetPrivateData(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            uint DataSize,                                                      ///* [annotation] */__in  UINT DataSize,
            IntPtr pData                                                        ///* [annotation] */__in_bcount_opt( DataSize )  const void *pData) = 0;
            );
        void SetPrivateDataInterface(                                           //virtual HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
            [In] ref Guid guid,                                                 ///* [annotation] */__in  REFGUID guid,
            [MarshalAs(UnmanagedType.IUnknown), In] object pData                ///* [annotation] */__in_opt  const IUnknown *pData) = 0;
            );
        #endregion
        [PreserveSig]
        uint GetContextFlags(                                   //virtual UINT STDMETHODCALLTYPE GetContextFlags( void) = 0;
            );
    }
    #endregion
    #endregion

    #region Interface Extensions
    public static class IDXGIDeviceExtensions
    {
        #region QueryResourceResidency
        public static void QueryResourceResidency(this IDXGIDevice _this,
            object pResources,
            out DXGI_RESIDENCY ResidencyStatus
            )
        {
            LP_IUnknown ppResources = new LP_IUnknown() { Value = pResources };
            IntPtr ptrResources = Marshal.AllocHGlobal(Marshal.SizeOf(ppResources));
            Marshal.StructureToPtr(ppResources, ptrResources, false);
            unsafe
            {
                fixed(void* pResidencyStatus = &ResidencyStatus)
                {
                    _this.QueryResourceResidency(ptrResources, new IntPtr(pResidencyStatus), 1);
                }
            }
            Marshal.DestroyStructure(ptrResources, typeof(LP_IUnknown));
            Marshal.FreeHGlobal(ptrResources);
        }
        public static void QueryResourceResidency(this IDXGIDevice _this,
            object[] ppResources,
            DXGI_RESIDENCY[] pResidencyStatus
            )
        {
            if (ppResources == null || pResidencyStatus == null) return;
            IntPtr[] arrResources = new IntPtr[ppResources.Length];
            for (int i = 0; i < ppResources.Length; ++i)
            {
                arrResources[i] = Marshal.GetIUnknownForObject(ppResources[i]);
            }
            unsafe
            {
                fixed (void* ptrResources = arrResources)
                {
                    fixed (void* ptrResidencyStatus = pResidencyStatus)
                    {
                        _this.QueryResourceResidency(new IntPtr(ptrResources), new IntPtr(ptrResidencyStatus), (uint)Math.Min(ppResources.Length, pResidencyStatus.Length));
                    }
                }
            }
            for (int i = 0; i < ppResources.Length; ++i)
            {
                Marshal.Release(arrResources[i]);
            }
        }
        #endregion
    }
    public static class ID3D11DeviceExtensions
    {
        #region CreateTexture2D
        public static void CreateTexture2D(this ID3D11Device _this,
            ref D3D11_TEXTURE2D_DESC pDesc,
            out ID3D11Texture2D ppTexture2D,
            LP_D3D11_SUBRESOURCE_DATA pInitialData = null
            )
        {
            LP_ID3D11Texture2D ppTexture2D1 = new LP_ID3D11Texture2D();
            _this.CreateTexture2D(ref pDesc, pInitialData, ppTexture2D1);
            ppTexture2D = ppTexture2D1.Value;
        }
        public static void CreateTexture2D(this ID3D11Device _this,
            D3D11_TEXTURE2D_DESC pDesc,
            out ID3D11Texture2D ppTexture2D,
            LP_D3D11_SUBRESOURCE_DATA pInitialData = null
            )
        {
            CreateTexture2D(_this, ref pDesc, out ppTexture2D, pInitialData);
        }
        #endregion
        #region CreateRenderTargetView
        public static void CreateRenderTargetView(this ID3D11Device _this,
            ID3D11Resource pResource,
            out ID3D11RenderTargetView ppRTView,
            [In] LP_D3D11_RENDER_TARGET_VIEW_DESC pDesc = null
            )
        {
            LP_ID3D11RenderTargetView ppRTView1 = new LP_ID3D11RenderTargetView();
            _this.CreateRenderTargetView(pResource, pDesc, ppRTView1);
            ppRTView = ppRTView1.Value;
        }
        #endregion
        #region CreateInputLayout
        public static void CreateInputLayout(this ID3D11Device _this,
            D3D11_INPUT_ELEMENT_DESC[] pInputElementDescs,
            IntPtr pShaderBytecodeWithInputSignature,
            long BytecodeLength,
            [Out] LP_ID3D11InputLayout ppInputLayout = null
            )
        {
            unsafe
            {
                fixed (void* ptrInputElementDescs = pInputElementDescs)
                {
                    _this.CreateInputLayout(new IntPtr(ptrInputElementDescs), (uint)pInputElementDescs.Length, pShaderBytecodeWithInputSignature, new IntPtr(BytecodeLength), ppInputLayout);
                }
            }
        }
        public static void CreateInputLayout(this ID3D11Device _this,
            D3D11_INPUT_ELEMENT_DESC_M[] pInputElementDescs,
            IntPtr pShaderBytecodeWithInputSignature,
            long BytecodeLength,
            [Out] LP_ID3D11InputLayout ppInputLayout = null
            )
        {
            if (pInputElementDescs == null) return;
            D3D11_INPUT_ELEMENT_DESC[] pInputElementDescs1 = new D3D11_INPUT_ELEMENT_DESC[pInputElementDescs.Length];
            for (int i = 0; i < pInputElementDescs.Length; ++i)
            {
                pInputElementDescs1[i] = pInputElementDescs[i];
            }
            CreateInputLayout(_this, pInputElementDescs1, pShaderBytecodeWithInputSignature, BytecodeLength, ppInputLayout);
            for (int i = 0; i < pInputElementDescs.Length; ++i)
            {
                pInputElementDescs1[i].Free();
            }
        }
        public static void CreateInputLayout(this ID3D11Device _this,
            ref D3D11_INPUT_ELEMENT_DESC pInputElementDescs,
            IntPtr pShaderBytecodeWithInputSignature,
            long BytecodeLength,
            [Out] LP_ID3D11InputLayout ppInputLayout = null
            )
        {
            unsafe
            {
                fixed (void* ptrInputElementDescs = &pInputElementDescs)
                {
                    _this.CreateInputLayout(new IntPtr(ptrInputElementDescs), 1, pShaderBytecodeWithInputSignature, new IntPtr(BytecodeLength), ppInputLayout);
                }
            }
        }
        public static void CreateInputLayout(this ID3D11Device _this,
            D3D11_INPUT_ELEMENT_DESC_M pInputElementDescs,
            IntPtr pShaderBytecodeWithInputSignature,
            long BytecodeLength,
            [Out] LP_ID3D11InputLayout ppInputLayout = null
            )
        {
            D3D11_INPUT_ELEMENT_DESC pInputElementDescs1 = pInputElementDescs;
            CreateInputLayout(_this, ref pInputElementDescs1, pShaderBytecodeWithInputSignature, BytecodeLength, ppInputLayout);
            pInputElementDescs1.Free();
        }
        public static void CreateInputLayout(this ID3D11Device _this,
            D3D11_INPUT_ELEMENT_DESC pInputElementDescs,
            IntPtr pShaderBytecodeWithInputSignature,
            long BytecodeLength,
            [Out] LP_ID3D11InputLayout ppInputLayout = null
            )
        {
            CreateInputLayout(_this, ref pInputElementDescs, pShaderBytecodeWithInputSignature, BytecodeLength, ppInputLayout);
        }
        #endregion
        #region CreateVertexShader
        public static void CreateVertexShader(this ID3D11Device _this,
            IntPtr pShaderBytecode,
            long BytecodeLength,
            ID3D11ClassLinkage pClassLinkage = null,
            [Out] LP_ID3D11VertexShader ppVertexShader = null
            )
        {
            _this.CreateVertexShader(pShaderBytecode, new IntPtr(BytecodeLength), pClassLinkage, ppVertexShader);
        }
        #endregion
        #region CreateGeometryShader
        public static void CreateGeometryShader(this ID3D11Device _this,
            IntPtr pShaderBytecode,
            long BytecodeLength,
            ID3D11ClassLinkage pClassLinkage = null,
            [Out] LP_ID3D11GeometryShader ppVertexShader = null
            )
        {
            _this.CreateGeometryShader(pShaderBytecode, new IntPtr(BytecodeLength), pClassLinkage, ppVertexShader);
        }
        #endregion
        #region CreateGeometryShaderWithStreamOutput
        public static void CreateGeometryShaderWithStreamOutput(this ID3D11Device _this,
            IntPtr pShaderBytecode,
            long BytecodeLength,
            D3D11_SO_DECLARATION_ENTRY[] pSODeclaration = null,
            uint[] pBufferStrides = null,
            uint RasterizedStream = DX11_Guids_And_Consts.D3D11_SO_NO_RASTERIZED_STREAM,
            ID3D11ClassLinkage pClassLinkage = null,
            [Out] LP_ID3D11GeometryShader ppGeometryShader = null
            )
        {
            unsafe
            {
                fixed (void* ptrSODeclaration = pSODeclaration)
                {
                    fixed (void* ptrBufferStrides = pBufferStrides)
                    {
                        _this.CreateGeometryShaderWithStreamOutput(pShaderBytecode, new IntPtr(BytecodeLength), new IntPtr(ptrSODeclaration), pSODeclaration != null ? (uint)pSODeclaration.Length : 0,
                            new IntPtr(ptrBufferStrides), pBufferStrides != null ? (uint)pBufferStrides.Length : 0, RasterizedStream, pClassLinkage, ppGeometryShader);
                    }
                }
            }
        }
        public static void CreateGeometryShaderWithStreamOutput(this ID3D11Device _this,
            IntPtr pShaderBytecode,
            long BytecodeLength,
            D3D11_SO_DECLARATION_ENTRY_M[] pSODeclaration = null,
            uint[] pBufferStrides = null,
            uint RasterizedStream = DX11_Guids_And_Consts.D3D11_SO_NO_RASTERIZED_STREAM,
            ID3D11ClassLinkage pClassLinkage = null,
            [Out] LP_ID3D11GeometryShader ppGeometryShader = null
            )
        {
            if (pSODeclaration == null)
            {
                unsafe
                {
                    fixed (void* ptrBufferStrides = pBufferStrides)
                    {
                        _this.CreateGeometryShaderWithStreamOutput(pShaderBytecode, new IntPtr(BytecodeLength), new IntPtr(0), 0,
                            new IntPtr(ptrBufferStrides), pBufferStrides != null ? (uint)pBufferStrides.Length : 0, RasterizedStream, pClassLinkage, ppGeometryShader);
                    }
                }
            }
            else
            {
                D3D11_SO_DECLARATION_ENTRY[] pSODeclaration1 = new D3D11_SO_DECLARATION_ENTRY[pSODeclaration.Length];
                for (int i = 0; i < pSODeclaration.Length; ++i)
                {
                    pSODeclaration1[i] = pSODeclaration[i];
                }
                CreateGeometryShaderWithStreamOutput(_this, pShaderBytecode, BytecodeLength, pSODeclaration1, pBufferStrides, RasterizedStream, pClassLinkage, ppGeometryShader);
                for (int i = 0; i < pSODeclaration.Length; ++i)
                {
                    pSODeclaration1[i].Free();
                }
            }
        }
        #endregion
        #region CreatePixelShader
        public static void CreatePixelShader(this ID3D11Device _this,
            IntPtr pShaderBytecode,
            long BytecodeLength,
            ID3D11ClassLinkage pClassLinkage = null,
            [Out] LP_ID3D11PixelShader ppPixelShader = null
            )
        {
            _this.CreatePixelShader(pShaderBytecode, new IntPtr(BytecodeLength), pClassLinkage, ppPixelShader);
        }
        #endregion
        #region CreateHullShader
        public static void CreateHullShader(this ID3D11Device _this,
            IntPtr pShaderBytecode,
            long BytecodeLength,
            ID3D11ClassLinkage pClassLinkage = null,
            [Out] LP_ID3D11HullShader ppHullShader = null
            )
        {
            _this.CreateHullShader(pShaderBytecode, new IntPtr(BytecodeLength), pClassLinkage, ppHullShader);
        }
        #endregion
        #region CreateDomainShader
        public static void CreateDomainShader(this ID3D11Device _this,
            IntPtr pShaderBytecode,
            long BytecodeLength,
            ID3D11ClassLinkage pClassLinkage = null,
            [Out] LP_ID3D11DomainShader ppDomainShader = null
            )
        {
            _this.CreateDomainShader(pShaderBytecode, new IntPtr(BytecodeLength), pClassLinkage, ppDomainShader);
        }
        #endregion
        #region CreateComputeShader
        public static void CreateComputeShader(this ID3D11Device _this,
            IntPtr pShaderBytecode,
            long BytecodeLength,
            ID3D11ClassLinkage pClassLinkage = null,
            [Out] LP_ID3D11ComputeShader ppComputeShader = null
            )
        {
            _this.CreateComputeShader(pShaderBytecode, new IntPtr(BytecodeLength), pClassLinkage, ppComputeShader);
        }
        public static void CreateComputeShader(this ID3D11Device _this,
            IntPtr pShaderBytecode,
            long BytecodeLength,
            [Out] out ID3D11ComputeShader ppComputeShader,
            ID3D11ClassLinkage pClassLinkage = null
            )
        {
            LP_ID3D11ComputeShader ppComputeShader1 = new LP_ID3D11ComputeShader();
            _this.CreateComputeShader(pShaderBytecode, new IntPtr(BytecodeLength), pClassLinkage, ppComputeShader1);
            ppComputeShader = ppComputeShader1.Value;
        }
        #endregion
        #region CheckCounter
        public static void CheckCounter(this ID3D11Device _this,
            ref D3D11_COUNTER_DESC pDesc,
            out D3D11_COUNTER_TYPE pType,
            out uint pActiveCounters,
            out string szName,
            out string szUnits,
            out string szDescription
            )
        {
            LP_UInt32 pnName = new LP_UInt32();
            LP_UInt32 pnUnits = new LP_UInt32();
            LP_UInt32 pnDescription = new LP_UInt32();
            _this.CheckCounter(ref pDesc, out pType, out pActiveCounters, pNameLength: pnName, pUnitsLength: pnUnits, pDescriptionLength: pnDescription);
            StringBuilder pName = new StringBuilder((int)pnName.Value);
            StringBuilder pUnits = new StringBuilder((int)pnUnits.Value);
            StringBuilder pDescription = new StringBuilder((int)pnDescription.Value);
            _this.CheckCounter(ref pDesc, out pType, out pActiveCounters, pName, pnName, pUnits, pnUnits, pDescription, pnDescription);
            szName = pName.ToString();
            szUnits = pUnits.ToString();
            szDescription = pDescription.ToString();
        }
        public static void CheckCounter(this ID3D11Device _this,
            D3D11_COUNTER_DESC pDesc,
            out D3D11_COUNTER_TYPE pType,
            out uint pActiveCounters,
            out string szName,
            out string szUnits,
            out string szDescription
            )
        {
            CheckCounter(_this, ref pDesc, out pType, out pActiveCounters, out szName, out szUnits, out szDescription);
        }
        #endregion
        #region CheckFeatureSupport
        public static void CheckFeatureSupport(this ID3D11Device _this,
            D3D11_FEATURE Feature,
            object pFeatureSupportData
            )
        {
            if (pFeatureSupportData == null) return;
            //try
            //{
            // blittable
            GCHandle hFeatureSupportData = GCHandle.Alloc(pFeatureSupportData, GCHandleType.Pinned);
            uint sizeFeatureSupportData = (uint)Marshal.SizeOf(pFeatureSupportData);
            _this.CheckFeatureSupport(Feature, hFeatureSupportData.AddrOfPinnedObject(), sizeFeatureSupportData);
            hFeatureSupportData.Free();
            return;
            //}
            //catch (ArgumentException) { }
            // non-blittable // not suportted now.
            //if (pFeatureSupportData.GetType().IsArray)
            //{
            //    // array
            //    return; // not suportted now.
            //    //Type tpElement = pFeatureSupportData.GetType().GetElementType();
            //    //if (tpElement.StructLayoutAttribute.Value == LayoutKind.Auto) return;
            //    //int nElementSize = Marshal.SizeOf(tpElement);
            //    //Array arr = (Array)pFeatureSupportData;
            //    //int nArrayLen = arr.Length;
            //    //int nByteCount = nArrayLen * nElementSize;
            //    //IntPtr ptrNative = Marshal.AllocHGlobal(nByteCount);
            //    //int index = -1;
            //    //foreach (object elem in arr)
            //    //{
            //    //    Marshal.StructureToPtr(elem, ptrNative + nElementSize * (++index), false);
            //    //}
            //    //_this.CheckFeatureSupport(Feature, ptrNative, (uint)nByteCount);
            //    //for (index = 0; index < nArrayLen; ++index)
            //    //{
            //    //    Marshal.DestroyStructure(ptrNative + nElementSize * index, tpElement);
            //    //}
            //    //Marshal.FreeHGlobal(ptrNative);
            //}
        }
        public static void CheckFeatureSupport<T>(this ID3D11Device _this,
            D3D11_FEATURE Feature,
            out T pFeatureSupportData
            ) where T : struct                                                      // Notice: Memory Copy. - regardless of whether it is blittable or not.
        {
            int sizeFeatureSupportData = Marshal.SizeOf(typeof(T));
            IntPtr hFeatureSupportData = Marshal.AllocHGlobal(sizeFeatureSupportData);
            _this.CheckFeatureSupport(Feature, hFeatureSupportData, (uint)sizeFeatureSupportData);
            pFeatureSupportData = (T)Marshal.PtrToStructure(hFeatureSupportData, typeof(T));
            Marshal.DestroyStructure(hFeatureSupportData, typeof(T));
            Marshal.FreeHGlobal(hFeatureSupportData);
        }
        public static void CheckFeatureSupport(this ID3D11Device _this,
            out D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS pFeatureSupportData
            )
        {
            unsafe
            {
                fixed (void* ptrFeatureSupportData = &pFeatureSupportData)
                {
                    _this.CheckFeatureSupport(D3D11_FEATURE.D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, new IntPtr(ptrFeatureSupportData), (uint)Marshal.SizeOf(typeof(D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS)));
                }
            }
        }
        public static void CheckFeatureSupport(this ID3D11Device _this,
            out D3D11_FEATURE_DATA_DOUBLES pFeatureSupportData
            )
        {
            unsafe
            {
                fixed (void* ptrFeatureSupportData = &pFeatureSupportData)
                {
                    _this.CheckFeatureSupport(D3D11_FEATURE.D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS, new IntPtr(ptrFeatureSupportData), (uint)Marshal.SizeOf(typeof(D3D11_FEATURE_DATA_DOUBLES)));
                }
            }
        }
        #endregion
    }
    public static class ID3D10BlobExtensions
    {
        public static long GetBufferSizeLong(this ID3D10Blob _this)
        {
            return _this.GetBufferSize().ToInt64();
        }
    }
    public static class ID3D11DeviceContextExtensions
    {
        #region VSSetConstantBuffers
        public static void VSSetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer[] ppConstantBuffers
            )
        {
            if (ppConstantBuffers == null) return;
            _this.VSSetConstantBuffers(StartSlot, (uint)ppConstantBuffers.Length, ppConstantBuffers);
        }
        public static void VSSetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer pConstantBuffers
            )
        {
            if (pConstantBuffers == null) return;
            _this.VSSetConstantBuffers(StartSlot, 1, new ID3D11Buffer[] { pConstantBuffers });
        }
        #endregion
        #region PSSetShaderResources
        public static void PSSetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView[] ppShaderResourceViews
            )
        {
            if (ppShaderResourceViews == null) return;
            _this.PSSetShaderResources(StartSlot, (uint)ppShaderResourceViews.Length, ppShaderResourceViews);
        }
        public static void PSSetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView pShaderResourceViews
            )
        {
            if (pShaderResourceViews == null) return;
            _this.PSSetShaderResources(StartSlot, 1, new ID3D11ShaderResourceView[] { pShaderResourceViews });
        }
        #endregion
        #region PSSetShader
        public static void PSSetShader(this ID3D11DeviceContext _this,
            ID3D11PixelShader pPixelShader,
            ID3D11ClassInstance[] ppClassInstances = null
            )
        {
            if (ppClassInstances == null)
                _this.PSSetShader(pPixelShader, null, 0);
            else
                _this.PSSetShader(pPixelShader, ppClassInstances, (uint)ppClassInstances.Length);
        }
        public static void PSSetShader(this ID3D11DeviceContext _this,
            ID3D11PixelShader pPixelShader,
            ID3D11ClassInstance pClassInstances
            )
        {
            if (pClassInstances == null)
                PSSetShader(_this, pPixelShader);
            else
                _this.PSSetShader(pPixelShader, new ID3D11ClassInstance[] { pClassInstances }, 1);
        }
        #endregion
        #region PSSetSamplers
        public static void PSSetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState[] ppSamplers
            )
        {
            if (ppSamplers == null) return;
            _this.PSSetSamplers(StartSlot, (uint)ppSamplers.Length, ppSamplers);
        }
        public static void PSSetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState pSamplers
            )
        {
            if (pSamplers == null) return;
            _this.PSSetSamplers(StartSlot, 1, new ID3D11SamplerState[] { pSamplers });
        }
        #endregion
        #region VSSetShader
        public static void VSSetShader(this ID3D11DeviceContext _this,
            ID3D11VertexShader pVertexShader,
            ID3D11ClassInstance[] ppClassInstances = null
            )
        {
            if (ppClassInstances == null)
                _this.VSSetShader(pVertexShader, null, 0);
            else
                _this.VSSetShader(pVertexShader, ppClassInstances, (uint)ppClassInstances.Length);
        }
        public static void VSSetShader(this ID3D11DeviceContext _this,
            ID3D11VertexShader pVertexShader,
            ID3D11ClassInstance pClassInstances
            )
        {
            if (pClassInstances == null)
                VSSetShader(_this, pVertexShader);
            else
                _this.VSSetShader(pVertexShader, new ID3D11ClassInstance[] { pClassInstances }, 1);
        }
        #endregion
        #region PSSetConstantBuffers
        public static void PSSetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer[] ppConstantBuffers
            )
        {
            if (ppConstantBuffers == null) return;
            _this.PSSetConstantBuffers(StartSlot, (uint)ppConstantBuffers.Length, ppConstantBuffers);
        }
        public static void PSSetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer pConstantBuffers
            )
        {
            if (pConstantBuffers == null) return;
            _this.PSSetConstantBuffers(StartSlot, 1, new ID3D11Buffer[] { pConstantBuffers });
        }
        #endregion
        #region IASetVertexBuffers
        public static void IASetVertexBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer[] ppVertexBuffers,
            uint[] pStrides,
            uint[] pOffsets
            )
        {
            if (ppVertexBuffers == null || ppVertexBuffers.Length == 0 || pStrides == null || pStrides.Length == 0 || pOffsets == null || pOffsets.Length == 0) return;
            uint uMin = (uint)Math.Min(ppVertexBuffers.Length, pStrides.Length);
            uMin = Math.Min(uMin, (uint)pOffsets.Length);
            _this.IASetVertexBuffers(StartSlot, uMin, ppVertexBuffers, pStrides, pOffsets);
        }
        public static void IASetVertexBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer pVertexBuffers,
            uint uStrides,
            uint uOffsets
            )
        {
            if (pVertexBuffers == null) return;
            _this.IASetVertexBuffers(StartSlot, 1, new ID3D11Buffer[] { pVertexBuffers }, new uint[] { uStrides }, new uint[] { uOffsets });
        }
        #endregion
        #region GSSetConstantBuffers
        public static void GSSetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer[] ppConstantBuffers
            )
        {
            if (ppConstantBuffers == null) return;
            _this.GSSetConstantBuffers(StartSlot, (uint)ppConstantBuffers.Length, ppConstantBuffers);
        }
        public static void GSSetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer pConstantBuffers
            )
        {
            if (pConstantBuffers == null) return;
            _this.GSSetConstantBuffers(StartSlot, 1, new ID3D11Buffer[] { pConstantBuffers });
        }
        #endregion
        #region GSSetShader
        public static void GSSetShader(this ID3D11DeviceContext _this,
            ID3D11GeometryShader pShader,
            ID3D11ClassInstance[] ppClassInstances = null
            )
        {
            if (ppClassInstances == null)
                _this.GSSetShader(pShader, null, 0);
            else
                _this.GSSetShader(pShader, ppClassInstances, (uint)ppClassInstances.Length);
        }
        public static void GSSetShader(this ID3D11DeviceContext _this,
            ID3D11GeometryShader pShader,
            ID3D11ClassInstance pClassInstances
            )
        {
            if (pClassInstances == null)
                GSSetShader(_this, pShader);
            else
                _this.GSSetShader(pShader, new ID3D11ClassInstance[] { pClassInstances }, 1);
        }
        #endregion
        #region VSSetShaderResources
        public static void VSSetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView[] ppShaderResourceViews
            )
        {
            if (ppShaderResourceViews == null) return;
            _this.VSSetShaderResources(StartSlot, (uint)ppShaderResourceViews.Length, ppShaderResourceViews);
        }
        public static void VSSetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView pShaderResourceViews
            )
        {
            if (pShaderResourceViews == null) return;
            _this.VSSetShaderResources(StartSlot, 1, new ID3D11ShaderResourceView[] { pShaderResourceViews });
        }
        #endregion
        #region VSSetSamplers
        public static void VSSetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState[] ppSamplers
            )
        {
            if (ppSamplers == null) return;
            _this.VSSetSamplers(StartSlot, (uint)ppSamplers.Length, ppSamplers);
        }
        public static void VSSetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState pSamplers
            )
        {
            if (pSamplers == null) return;
            _this.VSSetSamplers(StartSlot, 1, new ID3D11SamplerState[] { pSamplers });
        }
        #endregion
        #region GetData
        public static D3D11_RETURN_CODE GetData(this ID3D11DeviceContext _this,
            ID3D11Asynchronous pAsync,
            object pData,
            D3D11_ASYNC_GETDATA_FLAG GetDataFlags
            )
        {
            if (pData == null)
                return _this.GetData(pAsync, IntPtr.Zero, 0, GetDataFlags);
            D3D11_RETURN_CODE rv;
            try
            {
                // blittable
                GCHandle hData = GCHandle.Alloc(pData, GCHandleType.Pinned);
                uint sizeData = 0;
                if (pData.GetType().IsArray)
                {
                    sizeData = (uint)(Marshal.SizeOf(pData.GetType().GetElementType()) * ((Array)pData).Length);
                }
                else
                    sizeData = (uint)Marshal.SizeOf(pData);
                rv = _this.GetData(pAsync, hData.AddrOfPinnedObject(), sizeData, GetDataFlags);
                hData.Free();
                return rv;
            }
            catch (ArgumentException) { }
            // non-blittable
            if (pData.GetType().IsArray)
            {
                // array
                Type tpElement = pData.GetType().GetElementType();
                if (tpElement.StructLayoutAttribute.Value == LayoutKind.Auto)
                    return _this.GetData(pAsync, IntPtr.Zero, 0, GetDataFlags);
                int nElementSize = Marshal.SizeOf(tpElement);
                Array arr = (Array)pData;
                int nArrayLen = arr.Length;
                int nByteCount = nArrayLen * nElementSize;
                IntPtr ptrNative = Marshal.AllocHGlobal(nByteCount);
                rv = _this.GetData(pAsync, ptrNative, (uint)nByteCount, GetDataFlags);
                IntPtr ptrStruct = ptrNative;
                for (int index = 0; index < nArrayLen; ++index)
                {
                    arr.SetValue(Marshal.PtrToStructure(ptrStruct, tpElement), index);
                    Marshal.DestroyStructure(ptrStruct, tpElement);
                    ptrStruct += nElementSize;
                }
                Marshal.FreeHGlobal(ptrNative);
            }
            else
            {
                // object
                int nElementSize;
                try
                {
                    nElementSize = Marshal.SizeOf(pData);
                }
                catch (ArgumentException)
                {
                    return _this.GetData(pAsync, IntPtr.Zero, 0, GetDataFlags);
                }
                IntPtr ptrNative = Marshal.AllocHGlobal(nElementSize);
                rv = _this.GetData(pAsync, ptrNative, (uint)nElementSize, GetDataFlags);
                try
                {
                    Marshal.PtrToStructure(ptrNative, pData);
                }
                catch (ArgumentException) { }
                try
                {
                    Marshal.DestroyStructure(ptrNative, pData.GetType());
                }
                catch (ArgumentException) { }
                Marshal.FreeHGlobal(ptrNative);
            }
            return rv;
        }
        public static D3D11_RETURN_CODE GetData<T>(this ID3D11DeviceContext _this,
            ID3D11Asynchronous pAsync,
            out T pData,
            D3D11_ASYNC_GETDATA_FLAG GetDataFlags
            ) where T : struct                                                      // Notice: Memory Copy. - regardless of whether it is blittable or not.
        {
            D3D11_RETURN_CODE rv;
            int sizeData = Marshal.SizeOf(typeof(T));
            IntPtr hData = Marshal.AllocHGlobal(sizeData);
            rv = _this.GetData(pAsync, hData, (uint)sizeData, GetDataFlags);
            pData = (T)Marshal.PtrToStructure(hData, typeof(T));
            Marshal.DestroyStructure(hData, typeof(T));
            Marshal.FreeHGlobal(hData);
            return rv;
        }
        #endregion
        #region GSSetShaderResources
        public static void GSSetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView[] ppShaderResourceViews
            )
        {
            if (ppShaderResourceViews == null) return;
            _this.GSSetShaderResources(StartSlot, (uint)ppShaderResourceViews.Length, ppShaderResourceViews);
        }
        public static void GSSetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView pShaderResourceViews
            )
        {
            if (pShaderResourceViews == null) return;
            _this.GSSetShaderResources(StartSlot, 1, new ID3D11ShaderResourceView[] { pShaderResourceViews });
        }
        #endregion
        #region GSSetSamplers
        public static void GSSetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState[] ppSamplers
            )
        {
            if (ppSamplers == null) return;
            _this.GSSetSamplers(StartSlot, (uint)ppSamplers.Length, ppSamplers);
        }
        public static void GSSetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState pSamplers
            )
        {
            if (pSamplers == null) return;
            _this.GSSetSamplers(StartSlot, 1, new ID3D11SamplerState[] { pSamplers });
        }
        #endregion
        #region OMSetRenderTargets
        public static void OMSetRenderTargets(this ID3D11DeviceContext _this,
            ID3D11RenderTargetView[] ppRenderTargetViews,
            ID3D11DepthStencilView pDepthStencilView = null
            )
        {
            if (ppRenderTargetViews == null)
                _this.OMSetRenderTargets(0, null, pDepthStencilView);
            else
                _this.OMSetRenderTargets((uint)ppRenderTargetViews.Length, ppRenderTargetViews, pDepthStencilView);
        }
        public static void OMSetRenderTargets(this ID3D11DeviceContext _this,
            ID3D11RenderTargetView pRenderTargetViews,
            ID3D11DepthStencilView pDepthStencilView = null
            )
        {
            if (pRenderTargetViews == null)
                _this.OMSetRenderTargets(0, null, pDepthStencilView);
            else
                _this.OMSetRenderTargets(1, new ID3D11RenderTargetView[] { pRenderTargetViews }, pDepthStencilView);
        }
        #endregion
        #region OMSetRenderTargetsAndUnorderedAccessViews
        public static void OMSetRenderTargetsAndUnorderedAccessViews(this ID3D11DeviceContext _this,
            ID3D11RenderTargetView[] ppRenderTargetViews,
            uint UAVStartSlot,
            ID3D11UnorderedAccessView[] ppUnorderedAccessViews,
            uint[] pUAVInitialCounts,
            ID3D11DepthStencilView pDepthStencilView = null
            )
        {
            uint NumViews = 0;
            if (ppRenderTargetViews != null) NumViews = (uint)ppRenderTargetViews.Length;
            uint NumUAVs = 0;
            if (ppUnorderedAccessViews != null && pUAVInitialCounts != null)
                NumUAVs = (uint)Math.Min(ppUnorderedAccessViews.Length, pUAVInitialCounts.Length);
            _this.OMSetRenderTargetsAndUnorderedAccessViews(NumViews, ppRenderTargetViews, pDepthStencilView, UAVStartSlot, NumUAVs, ppUnorderedAccessViews, pUAVInitialCounts);
        }
        public static void OMSetRenderTargetsAndUnorderedAccessViews(this ID3D11DeviceContext _this,
            ID3D11RenderTargetView pRenderTargetViews,
            uint UAVStartSlot,
            ID3D11UnorderedAccessView[] ppUnorderedAccessViews,
            uint[] pUAVInitialCounts,
            ID3D11DepthStencilView pDepthStencilView = null
            )
        {
            uint NumViews = 0;
            if (pRenderTargetViews != null) NumViews = 1;
            uint NumUAVs = 0;
            if (ppUnorderedAccessViews != null && pUAVInitialCounts != null)
                NumUAVs = (uint)Math.Min(ppUnorderedAccessViews.Length, pUAVInitialCounts.Length);
            _this.OMSetRenderTargetsAndUnorderedAccessViews(NumViews, new ID3D11RenderTargetView[] { pRenderTargetViews }, pDepthStencilView, UAVStartSlot, NumUAVs, ppUnorderedAccessViews, pUAVInitialCounts);
        }
        public static void OMSetRenderTargetsAndUnorderedAccessViews(this ID3D11DeviceContext _this,
            ID3D11RenderTargetView[] ppRenderTargetViews,
            uint UAVStartSlot,
            ID3D11UnorderedAccessView pUnorderedAccessViews,
            uint UAVInitialCounts,
            ID3D11DepthStencilView pDepthStencilView = null
            )
        {
            uint NumViews = 0;
            if (ppRenderTargetViews != null) NumViews = (uint)ppRenderTargetViews.Length;
            uint NumUAVs = 0;
            if (pUnorderedAccessViews != null)
                NumUAVs = 1;
            _this.OMSetRenderTargetsAndUnorderedAccessViews(NumViews, ppRenderTargetViews, pDepthStencilView, UAVStartSlot, NumUAVs, new ID3D11UnorderedAccessView[] { pUnorderedAccessViews }, new uint[] { UAVInitialCounts });
        }
        public static void OMSetRenderTargetsAndUnorderedAccessViews(this ID3D11DeviceContext _this,
            ID3D11RenderTargetView pRenderTargetViews,
            uint UAVStartSlot,
            ID3D11UnorderedAccessView pUnorderedAccessViews,
            uint UAVInitialCounts,
            ID3D11DepthStencilView pDepthStencilView = null
            )
        {
            uint NumViews = 0;
            if (pRenderTargetViews != null) NumViews = 1;
            uint NumUAVs = 0;
            if (pUnorderedAccessViews != null)
                NumUAVs = 1;
            _this.OMSetRenderTargetsAndUnorderedAccessViews(NumViews, new ID3D11RenderTargetView[] { pRenderTargetViews }, pDepthStencilView, UAVStartSlot, NumUAVs, new ID3D11UnorderedAccessView[] { pUnorderedAccessViews }, new uint[] { UAVInitialCounts });
        }
        #endregion
        #region OMSetBlendState
        public static void OMSetBlendState(this ID3D11DeviceContext _this,
            ID3D11BlendState pBlendState,
            float[] BlendFactor,
            uint SampleMask = 0xffffffffU
            )
        {
            unsafe
            {
                fixed (void* ptrBlendFactor = BlendFactor)
                {
                    _this.OMSetBlendState(pBlendState, new IntPtr(ptrBlendFactor), SampleMask);
                }
            }
        }
        #endregion
        #region SOSetTargets
        public static void SOSetTargets(this ID3D11DeviceContext _this,
            ID3D11Buffer[] ppSOTargets,
            uint[] pOffsets
            )
        {
            uint NumBuffers = 0;
            if (ppSOTargets != null && pOffsets != null) NumBuffers = (uint)Math.Min(ppSOTargets.Length, pOffsets.Length);
            _this.SOSetTargets(NumBuffers, ppSOTargets, pOffsets);
        }
        #endregion
        #region RSSetViewports
        public static void RSSetViewports(this ID3D11DeviceContext _this,
            ref D3D11_VIEWPORT pViewports
            )
        {
            unsafe
            {
                fixed (void* ptrViewports = &pViewports)
                {
                    _this.RSSetViewports(1, new IntPtr(ptrViewports));
                }
            }
        }
        public static void RSSetViewports(this ID3D11DeviceContext _this,
            D3D11_VIEWPORT pViewports
            )
        {
            RSSetViewports(_this, ref pViewports);
        }
        public static void RSSetViewports(this ID3D11DeviceContext _this,
            D3D11_VIEWPORT[] pViewports
            )
        {
            if (pViewports == null)
            {
                _this.RSSetViewports(0, new IntPtr(0));
            }
            else
            {
                unsafe
                {
                    fixed (void* ptrViewports = pViewports)
                    {
                        _this.RSSetViewports((uint)pViewports.Length, new IntPtr(ptrViewports));
                    }
                }
            }
        }
        #endregion
        #region RSSetScissorRects
        public static void RSSetScissorRects(this ID3D11DeviceContext _this,
            ref D3D11_RECT pRects
            )
        {
            unsafe
            {
                fixed (void* ptrRects = &pRects)
                {
                    _this.RSSetScissorRects(1, new IntPtr(ptrRects));
                }
            }
        }
        public static void RSSetScissorRects(this ID3D11DeviceContext _this,
            D3D11_RECT pRects
            )
        {
            RSSetScissorRects(_this, ref pRects);
        }
        public static void RSSetScissorRects(this ID3D11DeviceContext _this,
            D3D11_RECT[] pRects
            )
        {
            if (pRects == null)
            {
                _this.RSSetScissorRects(0, new IntPtr(0));
            }
            else
            {
                unsafe
                {
                    fixed (void* ptrRects = pRects)
                    {
                        _this.RSSetScissorRects((uint)pRects.Length, new IntPtr(ptrRects));
                    }
                }
            }
        }
        #endregion
        #region CopySubresourceRegion
        public static void CopySubresourceRegion(this ID3D11DeviceContext _this,
            ID3D11Resource pDstResource,
            uint DstSubresource,
            uint DstX,
            uint DstY,
            uint DstZ,
            ID3D11Resource pSrcResource,
            uint SrcSubresource,
            ref D3D11_BOX pSrcBox
            )
        {
            unsafe
            {
                fixed (void* ptrSrcBox = &pSrcBox)
                {
                    _this.CopySubresourceRegion(pDstResource, DstSubresource, DstX, DstY, DstZ, pSrcResource, SrcSubresource, new IntPtr(ptrSrcBox));
                }
            }
        }
        public static void CopySubresourceRegion(this ID3D11DeviceContext _this,
            ID3D11Resource pDstResource,
            uint DstSubresource,
            uint DstX,
            uint DstY,
            uint DstZ,
            ID3D11Resource pSrcResource,
            uint SrcSubresource,
            D3D11_BOX pSrcBox
            )
        {
            CopySubresourceRegion(_this, pDstResource, DstSubresource, DstX, DstY, DstZ, pSrcResource, SrcSubresource, ref pSrcBox);
        }
        #endregion
        #region UpdateSubresource
        public static void UpdateSubresource(this ID3D11DeviceContext _this,
            ID3D11Resource pDstResource,
            uint DstSubresource,
            ref D3D11_BOX pDstBox,
            IntPtr pSrcData,
            uint SrcRowPitch,
            uint SrcDepthPitch
            )
        {
            unsafe
            {
                fixed (void* ptrDstBox = &pDstBox)
                {
                    _this.UpdateSubresource(pDstResource, DstSubresource, new IntPtr(ptrDstBox), pSrcData, SrcRowPitch, SrcDepthPitch);
                }
            }
        }
        public static void UpdateSubresource(this ID3D11DeviceContext _this,
            ID3D11Resource pDstResource,
            uint DstSubresource,
            IntPtr pSrcData,
            uint SrcRowPitch,
            uint SrcDepthPitch
            )
        {
            _this.UpdateSubresource(pDstResource, DstSubresource, IntPtr.Zero, pSrcData, SrcRowPitch, SrcDepthPitch);
        }
        #endregion
        #region ClearRenderTargetView
        public static void ClearRenderTargetView(this ID3D11DeviceContext _this,
            ID3D11RenderTargetView pRenderTargetView,
            float[] ColorRGBA
            )
        {
            unsafe
            {
                fixed (void* ptrColorRGBA = ColorRGBA)
                {
                    _this.ClearRenderTargetView(pRenderTargetView, new IntPtr(ptrColorRGBA));
                }
            }
        }
        #endregion
        #region HSSetShaderResources
        public static void HSSetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView[] ppShaderResourceViews
            )
        {
            if (ppShaderResourceViews == null) return;
            _this.HSSetShaderResources(StartSlot, (uint)ppShaderResourceViews.Length, ppShaderResourceViews);
        }
        public static void HSSetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView pShaderResourceViews
            )
        {
            if (pShaderResourceViews == null) return;
            _this.HSSetShaderResources(StartSlot, 1, new ID3D11ShaderResourceView[] { pShaderResourceViews });
        }
        #endregion
        #region HSSetShader
        public static void HSSetShader(this ID3D11DeviceContext _this,
            ID3D11HullShader pHullShader,
            ID3D11ClassInstance[] ppClassInstances = null
            )
        {
            if (ppClassInstances == null)
                _this.HSSetShader(pHullShader, null, 0);
            else
                _this.HSSetShader(pHullShader, ppClassInstances, (uint)ppClassInstances.Length);
        }
        public static void HSSetShader(this ID3D11DeviceContext _this,
            ID3D11HullShader pHullShader,
            ID3D11ClassInstance pClassInstances
            )
        {
            if (pClassInstances == null)
                HSSetShader(_this, pHullShader);
            else
                _this.HSSetShader(pHullShader, new ID3D11ClassInstance[] { pClassInstances }, 1);
        }
        #endregion
        #region HSSetSamplers
        public static void HSSetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState[] ppSamplers
            )
        {
            if (ppSamplers == null) return;
            _this.HSSetSamplers(StartSlot, (uint)ppSamplers.Length, ppSamplers);
        }
        public static void HSSetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState pSamplers
            )
        {
            if (pSamplers == null) return;
            _this.HSSetSamplers(StartSlot, 1, new ID3D11SamplerState[] { pSamplers });
        }
        #endregion
        #region HSSetConstantBuffers
        public static void HSSetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer[] ppConstantBuffers
            )
        {
            if (ppConstantBuffers == null) return;
            _this.HSSetConstantBuffers(StartSlot, (uint)ppConstantBuffers.Length, ppConstantBuffers);
        }
        public static void HSSetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer pConstantBuffers
            )
        {
            if (pConstantBuffers == null) return;
            _this.HSSetConstantBuffers(StartSlot, 1, new ID3D11Buffer[] { pConstantBuffers });
        }
        #endregion
        #region DSSetShaderResources
        public static void DSSetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView[] ppShaderResourceViews
            )
        {
            if (ppShaderResourceViews == null) return;
            _this.DSSetShaderResources(StartSlot, (uint)ppShaderResourceViews.Length, ppShaderResourceViews);
        }
        public static void DSSetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView pShaderResourceViews
            )
        {
            if (pShaderResourceViews == null) return;
            _this.DSSetShaderResources(StartSlot, 1, new ID3D11ShaderResourceView[] { pShaderResourceViews });
        }
        #endregion
        #region DSSetShader
        public static void DSSetShader(this ID3D11DeviceContext _this,
            ID3D11DomainShader pDomainShader,
            ID3D11ClassInstance[] ppClassInstances = null
            )
        {
            if (ppClassInstances == null)
                _this.DSSetShader(pDomainShader, null, 0);
            else
                _this.DSSetShader(pDomainShader, ppClassInstances, (uint)ppClassInstances.Length);
        }
        public static void DSSetShader(this ID3D11DeviceContext _this,
            ID3D11DomainShader pDomainShader,
            ID3D11ClassInstance pClassInstances
            )
        {
            if (pClassInstances == null)
                DSSetShader(_this, pDomainShader);
            else
                _this.DSSetShader(pDomainShader, new ID3D11ClassInstance[] { pClassInstances }, 1);
        }
        #endregion
        #region DSSetSamplers
        public static void DSSetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState[] ppSamplers
            )
        {
            if (ppSamplers == null) return;
            _this.DSSetSamplers(StartSlot, (uint)ppSamplers.Length, ppSamplers);
        }
        public static void DSSetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState pSamplers
            )
        {
            if (pSamplers == null) return;
            _this.DSSetSamplers(StartSlot, 1, new ID3D11SamplerState[] { pSamplers });
        }
        #endregion
        #region DSSetConstantBuffers
        public static void DSSetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer[] ppConstantBuffers
            )
        {
            if (ppConstantBuffers == null) return;
            _this.DSSetConstantBuffers(StartSlot, (uint)ppConstantBuffers.Length, ppConstantBuffers);
        }
        public static void DSSetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer pConstantBuffers
            )
        {
            if (pConstantBuffers == null) return;
            _this.DSSetConstantBuffers(StartSlot, 1, new ID3D11Buffer[] { pConstantBuffers });
        }
        #endregion
        #region CSSetShaderResources
        public static void CSSetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView[] ppShaderResourceViews
            )
        {
            if (ppShaderResourceViews == null) return;
            _this.CSSetShaderResources(StartSlot, (uint)ppShaderResourceViews.Length, ppShaderResourceViews);
        }
        public static void CSSetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView pShaderResourceViews
            )
        {
            if (pShaderResourceViews == null) return;
            _this.CSSetShaderResources(StartSlot, 1, new ID3D11ShaderResourceView[] { pShaderResourceViews });
        }
        #endregion
        #region CSSetUnorderedAccessViews
        public static void CSSetUnorderedAccessViews(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11UnorderedAccessView[] ppUnorderedAccessViews,
            uint[] pUAVInitialCounts
            )
        {
            if (ppUnorderedAccessViews == null) return;
            if (pUAVInitialCounts == null)
            {
                _this.CSSetUnorderedAccessViews(StartSlot, (uint)ppUnorderedAccessViews.Length, ppUnorderedAccessViews, null);
            }
            else
            {
                _this.CSSetUnorderedAccessViews(StartSlot, (uint)Math.Min(ppUnorderedAccessViews.Length, pUAVInitialCounts.Length), ppUnorderedAccessViews, pUAVInitialCounts);
            }
        }
        public static void CSSetUnorderedAccessViews(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11UnorderedAccessView pUnorderedAccessViews,
            uint UAVInitialCounts
            )
        {
            if (pUnorderedAccessViews == null) return;
            _this.CSSetUnorderedAccessViews(StartSlot, 1, new ID3D11UnorderedAccessView[] { pUnorderedAccessViews }, new uint[] { UAVInitialCounts });
        }
        #endregion
        #region CSSetShader
        public static void CSSetShader(this ID3D11DeviceContext _this,
            ID3D11ComputeShader pComputeShader,
            ID3D11ClassInstance[] ppClassInstances = null
            )
        {
            if (ppClassInstances == null)
                _this.CSSetShader(pComputeShader, null, 0);
            else
                _this.CSSetShader(pComputeShader, ppClassInstances, (uint)ppClassInstances.Length);
        }
        public static void CSSetShader(this ID3D11DeviceContext _this,
            ID3D11ComputeShader pComputeShader,
            ID3D11ClassInstance pClassInstances
            )
        {
            if (pClassInstances == null)
                CSSetShader(_this, pComputeShader);
            else
                _this.CSSetShader(pComputeShader, new ID3D11ClassInstance[] { pClassInstances }, 1);
        }
        #endregion
        #region CSSetSamplers
        public static void CSSetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState[] ppSamplers
            )
        {
            if (ppSamplers == null) return;
            _this.CSSetSamplers(StartSlot, (uint)ppSamplers.Length, ppSamplers);
        }
        public static void CSSetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState pSamplers
            )
        {
            if (pSamplers == null) return;
            _this.CSSetSamplers(StartSlot, 1, new ID3D11SamplerState[] { pSamplers });
        }
        #endregion
        #region CSSetConstantBuffers
        public static void CSSetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer[] ppConstantBuffers
            )
        {
            if (ppConstantBuffers == null) return;
            _this.CSSetConstantBuffers(StartSlot, (uint)ppConstantBuffers.Length, ppConstantBuffers);
        }
        public static void CSSetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer pConstantBuffers
            )
        {
            if (pConstantBuffers == null) return;
            _this.CSSetConstantBuffers(StartSlot, 1, new ID3D11Buffer[] { pConstantBuffers });
        }
        #endregion
        #region VSGetConstantBuffers
        public static void VSGetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer[] ppConstantBuffers
            )
        {
            if (ppConstantBuffers == null || ppConstantBuffers.Length == 0) return;
            _this.VSGetConstantBuffers(StartSlot, (uint)ppConstantBuffers.Length, ppConstantBuffers);
        }
        public static void VSGetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11Buffer ppConstantBuffers
            )
        {
            var arrConstantBuffers = new ID3D11Buffer[1];
            _this.VSGetConstantBuffers(StartSlot, 1, arrConstantBuffers);
            ppConstantBuffers = arrConstantBuffers[0];
        }
        #endregion
        #region PSGetShaderResources
        public static void PSGetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView[] ppShaderResourceViews
            )
        {
            if (ppShaderResourceViews == null || ppShaderResourceViews.Length == 0) return;
            _this.PSGetShaderResources(StartSlot, (uint)ppShaderResourceViews.Length, ppShaderResourceViews);
        }
        public static void PSGetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11ShaderResourceView ppShaderResourceViews
            )
        {
            var arrShaderResourceViews = new ID3D11ShaderResourceView[1];
            _this.PSGetShaderResources(StartSlot, 1, arrShaderResourceViews);
            ppShaderResourceViews = arrShaderResourceViews[0];
        }
        #endregion
        #region PSGetSamplers
        public static void PSGetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState[] ppSamplers
            )
        {
            if (ppSamplers == null || ppSamplers.Length == 0) return;
            _this.PSGetSamplers(StartSlot, (uint)ppSamplers.Length, ppSamplers);
        }
        public static void PSGetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11SamplerState ppSamplers
            )
        {
            var arrSamplers = new ID3D11SamplerState[1];
            _this.PSGetSamplers(StartSlot, 1, arrSamplers);
            ppSamplers = arrSamplers[0];
        }
        #endregion
        #region PSGetConstantBuffers
        public static void PSGetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer[] ppConstantBuffers
            )
        {
            if (ppConstantBuffers == null || ppConstantBuffers.Length == 0) return;
            _this.PSGetConstantBuffers(StartSlot, (uint)ppConstantBuffers.Length, ppConstantBuffers);
        }
        public static void PSGetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11Buffer ppConstantBuffers
            )
        {
            var arrConstantBuffers = new ID3D11Buffer[1];
            _this.PSGetConstantBuffers(StartSlot, 1, arrConstantBuffers);
            ppConstantBuffers = arrConstantBuffers[0];
        }
        #endregion
        #region GSGetConstantBuffers
        public static void GSGetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer[] ppConstantBuffers
            )
        {
            if (ppConstantBuffers == null || ppConstantBuffers.Length == 0) return;
            _this.GSGetConstantBuffers(StartSlot, (uint)ppConstantBuffers.Length, ppConstantBuffers);
        }
        public static void GSGetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11Buffer ppConstantBuffers
            )
        {
            var arrConstantBuffers = new ID3D11Buffer[1];
            _this.GSGetConstantBuffers(StartSlot, 1, arrConstantBuffers);
            ppConstantBuffers = arrConstantBuffers[0];
        }
        #endregion
        #region VSGetShaderResources
        public static void VSGetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView[] ppShaderResourceViews
            )
        {
            if (ppShaderResourceViews == null || ppShaderResourceViews.Length == 0) return;
            _this.VSGetShaderResources(StartSlot, (uint)ppShaderResourceViews.Length, ppShaderResourceViews);
        }
        public static void VSGetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11ShaderResourceView ppShaderResourceViews
            )
        {
            var arrShaderResourceViews = new ID3D11ShaderResourceView[1];
            _this.VSGetShaderResources(StartSlot, 1, arrShaderResourceViews);
            ppShaderResourceViews = arrShaderResourceViews[0];
        }
        #endregion
        #region VSGetSamplers
        public static void VSGetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState[] ppSamplers
            )
        {
            if (ppSamplers == null || ppSamplers.Length == 0) return;
            _this.VSGetSamplers(StartSlot, (uint)ppSamplers.Length, ppSamplers);
        }
        public static void VSGetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11SamplerState ppSamplers
            )
        {
            var arrSamplers = new ID3D11SamplerState[1];
            _this.VSGetSamplers(StartSlot, 1, arrSamplers);
            ppSamplers = arrSamplers[0];
        }
        #endregion
        #region GSGetShaderResources
        public static void GSGetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView[] ppShaderResourceViews
            )
        {
            if (ppShaderResourceViews == null || ppShaderResourceViews.Length == 0) return;
            _this.GSGetShaderResources(StartSlot, (uint)ppShaderResourceViews.Length, ppShaderResourceViews);
        }
        public static void GSGetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11ShaderResourceView ppShaderResourceViews
            )
        {
            var arrShaderResourceViews = new ID3D11ShaderResourceView[1];
            _this.GSGetShaderResources(StartSlot, 1, arrShaderResourceViews);
            ppShaderResourceViews = arrShaderResourceViews[0];
        }
        #endregion
        #region GSGetSamplers
        public static void GSGetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState[] ppSamplers
            )
        {
            if (ppSamplers == null || ppSamplers.Length == 0) return;
            _this.GSGetSamplers(StartSlot, (uint)ppSamplers.Length, ppSamplers);
        }
        public static void GSGetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11SamplerState ppSamplers
            )
        {
            var arrSamplers = new ID3D11SamplerState[1];
            _this.GSGetSamplers(StartSlot, 1, arrSamplers);
            ppSamplers = arrSamplers[0];
        }
        #endregion
        #region OMGetRenderTargets
        public static void OMGetRenderTargets(this ID3D11DeviceContext _this,
            ID3D11RenderTargetView[] ppRenderTargetViews,
            out ID3D11DepthStencilView ppDepthStencilView
            )
        {
            LP_ID3D11DepthStencilView ppDepthStencilView1 = new LP_ID3D11DepthStencilView();
            if (ppRenderTargetViews == null)
            {
                _this.OMGetRenderTargets(0, null, ppDepthStencilView1);
                ppDepthStencilView = ppDepthStencilView1.Value;
            }
            else
            {
                _this.OMGetRenderTargets((uint)ppRenderTargetViews.Length, ppRenderTargetViews, ppDepthStencilView1);
                ppDepthStencilView = ppDepthStencilView1.Value;
            }
        }
        public static void OMGetRenderTargets(this ID3D11DeviceContext _this,
            out ID3D11RenderTargetView ppRenderTargetViews,
            out ID3D11DepthStencilView ppDepthStencilView
            )
        {
            ID3D11RenderTargetView[] ppRenderTargetViews1 = new ID3D11RenderTargetView[1];
            LP_ID3D11DepthStencilView ppDepthStencilView1 = new LP_ID3D11DepthStencilView();
            _this.OMGetRenderTargets(1, ppRenderTargetViews1, ppDepthStencilView1);
            ppRenderTargetViews = ppRenderTargetViews1[0];
            ppDepthStencilView = ppDepthStencilView1.Value;
        }
        public static void OMGetRenderTargets(this ID3D11DeviceContext _this,
            out ID3D11RenderTargetView ppRenderTargetViews
            )
        {
            ID3D11RenderTargetView[] ppRenderTargetViews1 = new ID3D11RenderTargetView[1];
            _this.OMGetRenderTargets(1, ppRenderTargetViews1);
            ppRenderTargetViews = ppRenderTargetViews1[0];
        }
        #endregion
        #region OMGetRenderTargetsAndUnorderedAccessViews
        public static void OMGetRenderTargetsAndUnorderedAccessViews(this ID3D11DeviceContext _this,
            ID3D11RenderTargetView[] ppRenderTargetViews,
            out ID3D11DepthStencilView ppDepthStencilView,
            out ID3D11UnorderedAccessView ppUnorderedAccessViews,
            uint UAVStartSlot = 0
            )
        {
            LP_ID3D11DepthStencilView ppDepthStencilView1 = new LP_ID3D11DepthStencilView();
            ID3D11UnorderedAccessView[] ppUnorderedAccessViews1 = new ID3D11UnorderedAccessView[1];
            if (ppRenderTargetViews == null)
            {
                _this.OMGetRenderTargetsAndUnorderedAccessViews(0, null, ppDepthStencilView1, UAVStartSlot, 1, ppUnorderedAccessViews1);
            }
            else
            {
                _this.OMGetRenderTargetsAndUnorderedAccessViews((uint)ppRenderTargetViews.Length, ppRenderTargetViews, ppDepthStencilView1, UAVStartSlot, 1, ppUnorderedAccessViews1);
            }
            ppDepthStencilView = ppDepthStencilView1.Value;
            ppUnorderedAccessViews = ppUnorderedAccessViews1[0];
        }
        public static void OMGetRenderTargetsAndUnorderedAccessViews(this ID3D11DeviceContext _this,
            out ID3D11RenderTargetView ppRenderTargetViews,
            out ID3D11DepthStencilView ppDepthStencilView,
            out ID3D11UnorderedAccessView ppUnorderedAccessViews,
            uint UAVStartSlot = 0
            )
        {
            ID3D11RenderTargetView[] ppRenderTargetViews1 = new ID3D11RenderTargetView[1];
            LP_ID3D11DepthStencilView ppDepthStencilView1 = new LP_ID3D11DepthStencilView();
            ID3D11UnorderedAccessView[] ppUnorderedAccessViews1 = new ID3D11UnorderedAccessView[1];
            _this.OMGetRenderTargetsAndUnorderedAccessViews(1, ppRenderTargetViews1, ppDepthStencilView1, UAVStartSlot, 1, ppUnorderedAccessViews1);
            ppRenderTargetViews = ppRenderTargetViews1[0];
            ppDepthStencilView = ppDepthStencilView1.Value;
            ppUnorderedAccessViews = ppUnorderedAccessViews1[0];
        }
        public static void OMGetRenderTargetsAndUnorderedAccessViews(this ID3D11DeviceContext _this,
            out ID3D11RenderTargetView ppRenderTargetViews,
            out ID3D11UnorderedAccessView ppUnorderedAccessViews,
            uint UAVStartSlot = 0
            )
        {
            ID3D11RenderTargetView[] ppRenderTargetViews1 = new ID3D11RenderTargetView[1];
            ID3D11UnorderedAccessView[] ppUnorderedAccessViews1 = new ID3D11UnorderedAccessView[1];
            _this.OMGetRenderTargetsAndUnorderedAccessViews(1, ppRenderTargetViews1, null, UAVStartSlot, 1, ppUnorderedAccessViews1);
            ppRenderTargetViews = ppRenderTargetViews1[0];
            ppUnorderedAccessViews = ppUnorderedAccessViews1[0];
        }
        public static void OMGetRenderTargetsAndUnorderedAccessViews(this ID3D11DeviceContext _this,
            ID3D11RenderTargetView[] ppRenderTargetViews,
            out ID3D11DepthStencilView ppDepthStencilView,
            ID3D11UnorderedAccessView[] ppUnorderedAccessViews,
            uint UAVStartSlot = 0
            )
        {
            LP_ID3D11DepthStencilView ppDepthStencilView1 = new LP_ID3D11DepthStencilView();
            uint nLenNumUAV = 0;
            if (ppUnorderedAccessViews != null)
            {
                nLenNumUAV = (uint)ppUnorderedAccessViews.Length;
            }
            if (ppRenderTargetViews == null)
            {
                _this.OMGetRenderTargetsAndUnorderedAccessViews(0, null, ppDepthStencilView1, UAVStartSlot, nLenNumUAV, ppUnorderedAccessViews);
            }
            else
            {
                _this.OMGetRenderTargetsAndUnorderedAccessViews((uint)ppRenderTargetViews.Length, ppRenderTargetViews, ppDepthStencilView1, UAVStartSlot, nLenNumUAV, ppUnorderedAccessViews);
            }
            ppDepthStencilView = ppDepthStencilView1.Value;
        }
        public static void OMGetRenderTargetsAndUnorderedAccessViews(this ID3D11DeviceContext _this,
            out ID3D11RenderTargetView ppRenderTargetViews,
            out ID3D11DepthStencilView ppDepthStencilView,
            ID3D11UnorderedAccessView[] ppUnorderedAccessViews,
            uint UAVStartSlot = 0
            )
        {
            ID3D11RenderTargetView[] ppRenderTargetViews1 = new ID3D11RenderTargetView[1];
            LP_ID3D11DepthStencilView ppDepthStencilView1 = new LP_ID3D11DepthStencilView();
            uint nLenNumUAV = 0;
            if (ppUnorderedAccessViews != null)
            {
                nLenNumUAV = (uint)ppUnorderedAccessViews.Length;
            }
            _this.OMGetRenderTargetsAndUnorderedAccessViews(1, ppRenderTargetViews1, ppDepthStencilView1, UAVStartSlot, nLenNumUAV, ppUnorderedAccessViews);
            ppRenderTargetViews = ppRenderTargetViews1[0];
            ppDepthStencilView = ppDepthStencilView1.Value;
        }
        public static void OMGetRenderTargetsAndUnorderedAccessViews(this ID3D11DeviceContext _this,
            out ID3D11RenderTargetView ppRenderTargetViews,
            ID3D11UnorderedAccessView[] ppUnorderedAccessViews,
            uint UAVStartSlot = 0
            )
        {
            ID3D11RenderTargetView[] ppRenderTargetViews1 = new ID3D11RenderTargetView[1];
            uint nLenNumUAV = 0;
            if (ppUnorderedAccessViews != null)
            {
                nLenNumUAV = (uint)ppUnorderedAccessViews.Length;
            }
            _this.OMGetRenderTargetsAndUnorderedAccessViews(1, ppRenderTargetViews1, null, UAVStartSlot, nLenNumUAV, ppUnorderedAccessViews);
            ppRenderTargetViews = ppRenderTargetViews1[0];
        }
        #endregion
        #region OMGetBlendState
        public static void OMGetBlendState(this ID3D11DeviceContext _this,
            out ID3D11BlendState ppBlendState,
            float[] BlendFactor = null
            )
        {
            LP_ID3D11BlendState ppBlendState1 = new LP_ID3D11BlendState();
            _this.OMGetBlendState(ppBlendState1, BlendFactor, null);
            ppBlendState = ppBlendState1.Value;
        }
        public static void OMGetBlendState(this ID3D11DeviceContext _this,
            out uint pSampleMask,
            float[] BlendFactor = null
            )
        {
            LP_UInt32 pSampleMask1 = new LP_UInt32();
            _this.OMGetBlendState(null, BlendFactor, pSampleMask1);
            pSampleMask = pSampleMask1.Value;
        }
        public static void OMGetBlendState(this ID3D11DeviceContext _this,
            out ID3D11BlendState ppBlendState,
            out uint pSampleMask,
            float[] BlendFactor = null
            )
        {
            LP_ID3D11BlendState ppBlendState1 = new LP_ID3D11BlendState();
            LP_UInt32 pSampleMask1 = new LP_UInt32();
            _this.OMGetBlendState(ppBlendState1, BlendFactor, pSampleMask1);
            ppBlendState = ppBlendState1.Value;
            pSampleMask = pSampleMask1.Value;
        }
        #endregion
        #region OMGetDepthStencilState
        public static void OMGetDepthStencilState(this ID3D11DeviceContext _this,
            out ID3D11DepthStencilState ppDepthStencilState
            )
        {
            LP_ID3D11DepthStencilState ppDepthStencilState1 = new LP_ID3D11DepthStencilState();
            _this.OMGetDepthStencilState(ppDepthStencilState1, null);
            ppDepthStencilState = ppDepthStencilState1.Value;
        }
        public static void OMGetDepthStencilState(this ID3D11DeviceContext _this,
            out uint pStencilRef
            )
        {
            LP_UInt32 pStencilRef1 = new LP_UInt32();
            _this.OMGetDepthStencilState(null, pStencilRef1);
            pStencilRef = pStencilRef1.Value;
        }
        public static void OMGetDepthStencilState(this ID3D11DeviceContext _this,
            out ID3D11DepthStencilState ppDepthStencilState,
            out uint pStencilRef
            )
        {
            LP_ID3D11DepthStencilState ppDepthStencilState1 = new LP_ID3D11DepthStencilState();
            LP_UInt32 pStencilRef1 = new LP_UInt32();
            _this.OMGetDepthStencilState(ppDepthStencilState1, pStencilRef1);
            ppDepthStencilState = ppDepthStencilState1.Value;
            pStencilRef = pStencilRef1.Value;
        }
        #endregion
        #region SOGetTargets
        public static void SOGetTargets(this ID3D11DeviceContext _this,
            out ID3D11Buffer ppSOTargets
            )
        {
            ID3D11Buffer[] ppSOTargets1 = new ID3D11Buffer[1];
            _this.SOGetTargets(1, ppSOTargets1);
            ppSOTargets = ppSOTargets1[0];
        }
        public static void SOGetTargets(this ID3D11DeviceContext _this,
            ID3D11Buffer[] ppSOTargets
            )
        {
            if (ppSOTargets != null)
            {
                _this.SOGetTargets((uint)ppSOTargets.Length, ppSOTargets);
            }
        }
        #endregion
        #region RSGetViewports
        public static int RSGetViewportsCount(this ID3D11DeviceContext _this)
        {
            LP_UInt32 pNumViewports = new LP_UInt32();
            _this.RSGetViewports(pNumViewports, IntPtr.Zero);
            return (int)pNumViewports.Value;
        }
        public static void RSGetViewports(this ID3D11DeviceContext _this,
            out D3D11_VIEWPORT pViewport
            )
        {
            unsafe
            {
                fixed (void* pViewports = &pViewport)
                {
                    _this.RSGetViewports(new LP_UInt32() { Value = 1 }, new IntPtr(pViewports));
                }
            }
        }
        public static void RSGetViewports(this ID3D11DeviceContext _this,
            D3D11_VIEWPORT[] pViewports
            )
        {
            if (pViewports != null)
            {
                unsafe
                {
                    fixed (void* pViewports1 = pViewports)
                    {
                        _this.RSGetViewports(new LP_UInt32() { Value = (uint)pViewports.Length }, new IntPtr(pViewports1));
                    }
                }
            }
        }
        public static D3D11_VIEWPORT[] RSGetViewports(this ID3D11DeviceContext _this)
        {
            LP_UInt32 pNumViewports = new LP_UInt32();
            _this.RSGetViewports(pNumViewports, IntPtr.Zero);
            D3D11_VIEWPORT[] arrViewports = new D3D11_VIEWPORT[pNumViewports.Value];
            unsafe
            {
                fixed (void* pViewports = arrViewports)
                {
                    _this.RSGetViewports(pNumViewports, new IntPtr(pViewports));
                }
            }
            return arrViewports;
        }
        #endregion
        #region RSGetScissorRects
        public static int RSGetScissorRectsCount(this ID3D11DeviceContext _this)
        {
            LP_UInt32 pNumRects = new LP_UInt32();
            _this.RSGetScissorRects(pNumRects, IntPtr.Zero);
            return (int)pNumRects.Value;
        }
        public static void RSGetScissorRects(this ID3D11DeviceContext _this,
            out D3D11_RECT pRect
            )
        {
            unsafe
            {
                fixed (void* pRects = &pRect)
                {
                    _this.RSGetScissorRects(new LP_UInt32() { Value = 1 }, new IntPtr(pRects));
                }
            }
        }
        public static void RSGetScissorRects(this ID3D11DeviceContext _this,
            D3D11_RECT[] pRects
            )
        {
            if (pRects != null)
            {
                unsafe
                {
                    fixed (void* pRects1 = pRects)
                    {
                        _this.RSGetScissorRects(new LP_UInt32() { Value = (uint)pRects.Length }, new IntPtr(pRects1));
                    }
                }
            }
        }
        public static D3D11_RECT[] RSGetScissorRects(this ID3D11DeviceContext _this)
        {
            LP_UInt32 pNumRects = new LP_UInt32();
            _this.RSGetScissorRects(pNumRects, IntPtr.Zero);
            D3D11_RECT[] arrRects = new D3D11_RECT[pNumRects.Value];
            unsafe
            {
                fixed (void* pRects = arrRects)
                {
                    _this.RSGetScissorRects(pNumRects, new IntPtr(pRects));
                }
            }
            return arrRects;
        }
        #endregion
        #region HSGetShaderResources
        public static void HSGetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView[] ppShaderResourceViews
            )
        {
            if (ppShaderResourceViews == null || ppShaderResourceViews.Length == 0) return;
            _this.HSGetShaderResources(StartSlot, (uint)ppShaderResourceViews.Length, ppShaderResourceViews);
        }
        public static void HSGetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11ShaderResourceView ppShaderResourceViews
            )
        {
            var arrShaderResourceViews = new ID3D11ShaderResourceView[1];
            _this.HSGetShaderResources(StartSlot, 1, arrShaderResourceViews);
            ppShaderResourceViews = arrShaderResourceViews[0];
        }
        #endregion
        #region HSGetSamplers
        public static void HSGetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState[] ppSamplers
            )
        {
            if (ppSamplers == null || ppSamplers.Length == 0) return;
            _this.HSGetSamplers(StartSlot, (uint)ppSamplers.Length, ppSamplers);
        }
        public static void HSGetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11SamplerState ppSamplers
            )
        {
            var arrSamplers = new ID3D11SamplerState[1];
            _this.HSGetSamplers(StartSlot, 1, arrSamplers);
            ppSamplers = arrSamplers[0];
        }
        #endregion
        #region HSGetConstantBuffers
        public static void HSGetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer[] ppConstantBuffers
            )
        {
            if (ppConstantBuffers == null || ppConstantBuffers.Length == 0) return;
            _this.HSGetConstantBuffers(StartSlot, (uint)ppConstantBuffers.Length, ppConstantBuffers);
        }
        public static void HSGetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11Buffer ppConstantBuffers
            )
        {
            var arrConstantBuffers = new ID3D11Buffer[1];
            _this.HSGetConstantBuffers(StartSlot, 1, arrConstantBuffers);
            ppConstantBuffers = arrConstantBuffers[0];
        }
        #endregion
        #region DSGetShaderResources
        public static void DSGetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView[] ppShaderResourceViews
            )
        {
            if (ppShaderResourceViews == null || ppShaderResourceViews.Length == 0) return;
            _this.DSGetShaderResources(StartSlot, (uint)ppShaderResourceViews.Length, ppShaderResourceViews);
        }
        public static void DSGetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11ShaderResourceView ppShaderResourceViews
            )
        {
            var arrShaderResourceViews = new ID3D11ShaderResourceView[1];
            _this.DSGetShaderResources(StartSlot, 1, arrShaderResourceViews);
            ppShaderResourceViews = arrShaderResourceViews[0];
        }
        #endregion
        #region DSGetSamplers
        public static void DSGetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState[] ppSamplers
            )
        {
            if (ppSamplers == null || ppSamplers.Length == 0) return;
            _this.DSGetSamplers(StartSlot, (uint)ppSamplers.Length, ppSamplers);
        }
        public static void DSGetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11SamplerState ppSamplers
            )
        {
            var arrSamplers = new ID3D11SamplerState[1];
            _this.DSGetSamplers(StartSlot, 1, arrSamplers);
            ppSamplers = arrSamplers[0];
        }
        #endregion
        #region DSGetConstantBuffers
        public static void DSGetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer[] ppConstantBuffers
            )
        {
            if (ppConstantBuffers == null || ppConstantBuffers.Length == 0) return;
            _this.DSGetConstantBuffers(StartSlot, (uint)ppConstantBuffers.Length, ppConstantBuffers);
        }
        public static void DSGetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11Buffer ppConstantBuffers
            )
        {
            var arrConstantBuffers = new ID3D11Buffer[1];
            _this.DSGetConstantBuffers(StartSlot, 1, arrConstantBuffers);
            ppConstantBuffers = arrConstantBuffers[0];
        }
        #endregion
        #region CSGetShaderResources
        public static void CSGetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11ShaderResourceView[] ppShaderResourceViews
            )
        {
            if (ppShaderResourceViews == null || ppShaderResourceViews.Length == 0) return;
            _this.CSGetShaderResources(StartSlot, (uint)ppShaderResourceViews.Length, ppShaderResourceViews);
        }
        public static void CSGetShaderResources(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11ShaderResourceView ppShaderResourceViews
            )
        {
            var arrShaderResourceViews = new ID3D11ShaderResourceView[1];
            _this.CSGetShaderResources(StartSlot, 1, arrShaderResourceViews);
            ppShaderResourceViews = arrShaderResourceViews[0];
        }
        #endregion
        #region CSGetUnorderedAccessViews
        public static void CSGetUnorderedAccessViews(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11UnorderedAccessView[] ppUnorderedAccessViews
            )
        {
            if (ppUnorderedAccessViews == null || ppUnorderedAccessViews.Length == 0) return;
            _this.CSGetUnorderedAccessViews(StartSlot, (uint)ppUnorderedAccessViews.Length, ppUnorderedAccessViews);
        }
        public static void CSGetUnorderedAccessViews(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11UnorderedAccessView ppUnorderedAccessViews
            )
        {
            var arrUnorderedAccessViews = new ID3D11UnorderedAccessView[1];
            _this.CSGetUnorderedAccessViews(StartSlot, 1, arrUnorderedAccessViews);
            ppUnorderedAccessViews = arrUnorderedAccessViews[0];
        }
        #endregion
        #region CSGetSamplers
        public static void CSGetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11SamplerState[] ppSamplers
            )
        {
            if (ppSamplers == null || ppSamplers.Length == 0) return;
            _this.CSGetSamplers(StartSlot, (uint)ppSamplers.Length, ppSamplers);
        }
        public static void CSGetSamplers(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11SamplerState ppSamplers
            )
        {
            var arrSamplers = new ID3D11SamplerState[1];
            _this.CSGetSamplers(StartSlot, 1, arrSamplers);
            ppSamplers = arrSamplers[0];
        }
        #endregion
        #region CSGetConstantBuffers
        public static void CSGetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            ID3D11Buffer[] ppConstantBuffers
            )
        {
            if (ppConstantBuffers == null || ppConstantBuffers.Length == 0) return;
            _this.CSGetConstantBuffers(StartSlot, (uint)ppConstantBuffers.Length, ppConstantBuffers);
        }
        public static void CSGetConstantBuffers(this ID3D11DeviceContext _this,
            uint StartSlot,
            out ID3D11Buffer ppConstantBuffers
            )
        {
            var arrConstantBuffers = new ID3D11Buffer[1];
            _this.CSGetConstantBuffers(StartSlot, 1, arrConstantBuffers);
            ppConstantBuffers = arrConstantBuffers[0];
        }
        #endregion
    }
    #endregion

    #region Structs
    #region Legacy
    #region DX9
    #region D3DPRESENT_PARAMETERS
    [StructLayout(LayoutKind.Sequential)]
    public struct D3DPRESENT_PARAMETERS
    {
        public uint BackBufferWidth;                       //UINT BackBufferWidth;
        public uint BackBufferHeight;                      //UINT BackBufferHeight;
        public uint BackBufferFormat;                      //D3DFORMAT BackBufferFormat;
        public uint BackBufferCount;                       //UINT BackBufferCount;
         
        public uint MultiSampleType;                       //D3DMULTISAMPLE_TYPE MultiSampleType;
        public uint MultiSampleQuality;                    //DWORD MultiSampleQuality;

        public D3DSWAPEFFECT SwapEffect;                   //D3DSWAPEFFECT SwapEffect;
        public IntPtr hDeviceWindow;                       //HWND hDeviceWindow;
        public int Windowed;                               //BOOL Windowed;
        public int EnableAutoDepthStencil;                 //BOOL EnableAutoDepthStencil;
        public uint AutoDepthStencilFormat;                //D3DFORMAT AutoDepthStencilFormat;
        public uint Flags;                                 //DWORD Flags;
         
        ///* FullScreen_RefreshRateInHz must be zero for Windowed mode */
        public uint FullScreen_RefreshRateInHz;            //UINT FullScreen_RefreshRateInHz;
        public D3DPRESENT PresentationInterval;            //UINT PresentationInterval;
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_D3DPRESENT_PARAMETERS
    {
        public D3DPRESENT_PARAMETERS Value;
    }
    #endregion
    #region D3DDISPLAYMODEEX
    public struct D3DDISPLAYMODEEX
    {
        public uint Size;                               //UINT                Size;
        public uint Width;                              //UINT                Width;
        public uint Height;                             //UINT                Height;
        public uint RefreshRate;                        //UINT                RefreshRate;
        public D3DFORMAT Format;                        //D3DFORMAT           Format;
        public D3DSCANLINEORDERING ScanLineOrdering;    //D3DSCANLINEORDERING ScanLineOrdering;
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_D3DDISPLAYMODEEX
    {
        public D3DDISPLAYMODEEX Value;
    }
    #endregion
    #endregion
    #endregion

    #region DXGI
    public unsafe struct DXGI_ADAPTER_DESC
    {
        public fixed char Description[128];                     //WCHAR Description[ 128 ];
        public uint VendorId;                                   //UINT VendorId;
        public uint DeviceId;                                   //UINT DeviceId;
        public uint SubSysId;                                   //UINT SubSysId;
        public uint Revision;                                   //UINT Revision;
        public IntPtr DedicatedVideoMemory;                     //SIZE_T DedicatedVideoMemory;
        public IntPtr DedicatedSystemMemory;                    //SIZE_T DedicatedSystemMemory;
        public IntPtr SharedSystemMemory;                       //SIZE_T SharedSystemMemory;
        public ulong AdapterLuid;                               //LUID AdapterLuid;
        public string DescriptionString
        {
            get
            {
                unsafe
                {
                    fixed (char* pDescription = Description)
                    {
                        return new string(pDescription);
                    }
                }
            }
            set
            {
                unsafe
                {
                    fixed (char* pDescription = Description)
                    {
                        if (value == null)
                        {
                            pDescription[0] = '\0';
                        }
                        else
                        {
                            fixed (char* pValue = value)
                            {
                                uint Length = (uint)Math.Min(value.Length, 127);
                                DX11ImportLib_GlobalMethods.CopyMemory(pDescription, pValue, Length * 2);
                                pDescription[Length] = '\0';
                            }
                        }
                    }
                }
            }
        }
        public long DedicatedVideoMemorySize
        {
            get { return DedicatedVideoMemory.ToInt64(); }
            set { DedicatedVideoMemory = new IntPtr(value); }
        }
        public long DedicatedSystemMemorySize
        {
            get { return DedicatedSystemMemory.ToInt64(); }
            set { DedicatedSystemMemory = new IntPtr(value); }
        }
        public long SharedSystemMemorySize
        {
            get { return SharedSystemMemory.ToInt64(); }
            set { SharedSystemMemory = new IntPtr(value); }
        }
    }
    public struct DXGI_RATIONAL
    {
        public uint Numerator;                                  //UINT Numerator;
        public uint Denominator;                                //UINT Denominator;
    }
    public struct DXGI_MODE_DESC
    {
        public uint Width;                                      //UINT Width;
        public uint Height;                                     //UINT Height;
        public DXGI_RATIONAL RefreshRate;                       //DXGI_RATIONAL RefreshRate;                              
        public DXGI_FORMAT Format;                              //DXGI_FORMAT Format;                                     
        public DXGI_MODE_SCANLINE_ORDER ScanlineOrdering;       //DXGI_MODE_SCANLINE_ORDER ScanlineOrdering;              
        public DXGI_MODE_SCALING Scaling;                       //DXGI_MODE_SCALING Scaling;                              
    }
    public struct DXGI_SAMPLE_DESC
    {
        public uint Count;                                      //UINT Count;
        public uint Quality;                                    //UINT Quality;
    }
    #region DXGI_SWAP_CHAIN_DESC
    public struct DXGI_SWAP_CHAIN_DESC
    {
        public DXGI_MODE_DESC BufferDesc;                       //DXGI_MODE_DESC BufferDesc;
        public DXGI_SAMPLE_DESC SampleDesc;                     //DXGI_SAMPLE_DESC SampleDesc;
        public DXGI_USAGE BufferUsage;                          //DXGI_USAGE BufferUsage;
        public uint BufferCount;                                //UINT BufferCount;
        public IntPtr OutputWindow;                             //HWND OutputWindow;
        public int Windowed;                                    //BOOL Windowed;
        public DXGI_SWAP_EFFECT SwapEffect;                     //DXGI_SWAP_EFFECT SwapEffect;
        public DXGI_SWAP_CHAIN_FLAG Flags;                      //UINT Flags;
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_DXGI_SWAP_CHAIN_DESC
    {
        public DXGI_SWAP_CHAIN_DESC Value;
    }
    #endregion
    public struct DXGI_FRAME_STATISTICS
    {
        public uint PresentCount;                                      //UINT PresentCount;
        public uint PresentRefreshCount;                               //UINT PresentRefreshCount;
        public uint SyncRefreshCount;                                  //UINT SyncRefreshCount;
        public ulong SyncQPCTime;                                      //LARGE_INTEGER SyncQPCTime;
        public ulong SyncGPUTime;                                      //LARGE_INTEGER SyncGPUTime;
    }
    public struct DXGI_SURFACE_DESC
    {
        public uint Width;                                                     //UINT Width;
        public uint Height;                                                    //UINT Height;
        public DXGI_FORMAT Format;                                             //DXGI_FORMAT Format;
        public DXGI_SAMPLE_DESC SampleDesc;                                    //DXGI_SAMPLE_DESC SampleDesc;
    }
    #region DXGI_SHARED_RESOURCE
    public struct DXGI_SHARED_RESOURCE
    {
        public IntPtr Handle;                                                   //HANDLE Handle;
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_DXGI_SHARED_RESOURCE
    {
        public DXGI_SHARED_RESOURCE Value;
    }
    #endregion
    #endregion

    #region D3D
    public struct D3D11_TEXTURE2D_DESC
    {
        public uint Width;                                             //UINT Width;
        public uint Height;                                            //UINT Height;
        public uint MipLevels;                                         //UINT MipLevels;
        public uint ArraySize;                                         //UINT ArraySize;
        public DXGI_FORMAT Format;                                     //DXGI_FORMAT Format;
        public DXGI_SAMPLE_DESC SampleDesc;                            //DXGI_SAMPLE_DESC SampleDesc;
        public D3D11_USAGE Usage;                                      //D3D11_USAGE Usage;
        public D3D11_BIND_FLAG BindFlags;                              //UINT BindFlags;
        public D3D11_CPU_ACCESS_FLAG CPUAccessFlags;                   //UINT CPUAccessFlags;
        public D3D11_RESOURCE_MISC_FLAG MiscFlags;                     //UINT MiscFlags;
    }
    public struct D3D11_TEXTURE3D_DESC
    {
        public uint Width;                                              //UINT Width;
        public uint Height;                                             //UINT Height;
        public uint Depth;                                              //UINT Depth;
        public uint MipLevels;                                          //UINT MipLevels;
        public DXGI_FORMAT Format;                                      //DXGI_FORMAT Format;
        public D3D11_USAGE Usage;                                       //D3D11_USAGE Usage;
        public uint BindFlags;                                          //UINT BindFlags;
        public uint CPUAccessFlags;                                     //UINT CPUAccessFlags;
        public uint MiscFlags;                                          //UINT MiscFlags;
    }
    public struct D3D11_BUFFER_DESC
    {
        public uint ByteWidth;                                    //UINT ByteWidth;
        public D3D11_USAGE Usage;                                 //D3D11_USAGE Usage;
        public D3D11_BIND_FLAG BindFlags;                         //UINT BindFlags;
        public D3D11_CPU_ACCESS_FLAG CPUAccessFlags;              //UINT CPUAccessFlags;
        public D3D11_RESOURCE_MISC_FLAG MiscFlags;                //UINT MiscFlags;
        public uint StructureByteStride;                          //UINT StructureByteStride;
    }
    #region D3D11_SUBRESOURCE_DATA
    public struct D3D11_SUBRESOURCE_DATA
    {
        public IntPtr pSysMem;                                    //const void *pSysMem;  
        public uint SysMemPitch;                                  //UINT SysMemPitch;
        public uint SysMemSlicePitch;                             //UINT SysMemSlicePitch;
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_D3D11_SUBRESOURCE_DATA
    {
        public D3D11_SUBRESOURCE_DATA Value;
    }
    #endregion
    [StructLayout(LayoutKind.Explicit)]
    public struct D3D11_BUFFER_RTV
    {
        [FieldOffset(0)]                    //union 
        public uint FirstElement;           //    {
        [FieldOffset(0)]                    //    UINT FirstElement;
        public uint ElementOffset;          //    UINT ElementOffset;
                                            //    } 	;
        [FieldOffset(sizeof(uint))]         //union 
        public uint NumElements;            //    {
        [FieldOffset(sizeof(uint))]         //    UINT NumElements;
        public uint ElementWidth;           //    UINT ElementWidth;
                                            //    } 	;
    }
    public struct D3D11_TEX1D_RTV
    {
        public uint MipSlice;                                       //UINT MipSlice;
    }
    public struct D3D11_TEX1D_ARRAY_RTV
    {
        public uint MipSlice;                                       //UINT MipSlice;
        public uint FirstArraySlice;                                //UINT FirstArraySlice;
        public uint ArraySize;                                      //UINT ArraySize;
    }
    public struct D3D11_TEX2D_RTV
    {
        public uint MipSlice;                                       //UINT MipSlice;
    }
    public struct D3D11_TEX2D_ARRAY_RTV
    {
        public uint MipSlice;                                       //UINT MipSlice;
        public uint FirstArraySlice;                                //UINT FirstArraySlice;
        public uint ArraySize;                                      //UINT ArraySize;
    }
    public struct D3D11_TEX2DMS_RTV
    {
        public uint UnusedField_NothingToDefine;                    //UINT UnusedField_NothingToDefine;
    }
    public struct D3D11_TEX2DMS_ARRAY_RTV
    {
        public uint FirstArraySlice;                                //UINT FirstArraySlice;
        public uint ArraySize;                                      //UINT ArraySize;
    }
    public struct D3D11_TEX3D_RTV
    {
        public uint MipSlice;                                       //UINT MipSlice;
        public uint FirstWSlice;                                    //UINT FirstWSlice;
        public uint WSize;                                          //UINT WSize;
    }
    #region D3D11_RENDER_TARGET_VIEW_DESC
    [StructLayout(LayoutKind.Explicit)]
    public struct D3D11_RENDER_TARGET_VIEW_DESC
    {
        [FieldOffset(0)]
        public DXGI_FORMAT Format;                                  //DXGI_FORMAT Format;
        [FieldOffset(sizeof(DXGI_FORMAT))]
        public D3D11_RTV_DIMENSION ViewDimension;                   //D3D11_RTV_DIMENSION ViewDimension;
                                                                    //union
                                                                    //    {
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_RTV_DIMENSION))]
        public D3D11_BUFFER_RTV Buffer;                             //    D3D11_BUFFER_RTV Buffer;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_RTV_DIMENSION))]
        public D3D11_TEX1D_RTV Texture1D;                           //    D3D11_TEX1D_RTV Texture1D;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_RTV_DIMENSION))]
        public D3D11_TEX1D_ARRAY_RTV Texture1DArray;                //    D3D11_TEX1D_ARRAY_RTV Texture1DArray;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_RTV_DIMENSION))]
        public D3D11_TEX2D_RTV Texture2D;                           //    D3D11_TEX2D_RTV Texture2D;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_RTV_DIMENSION))]
        public D3D11_TEX2D_ARRAY_RTV Texture2DArray;                //    D3D11_TEX2D_ARRAY_RTV Texture2DArray;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_RTV_DIMENSION))]
        public D3D11_TEX2DMS_RTV Texture2DMS;                       //    D3D11_TEX2DMS_RTV Texture2DMS;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_RTV_DIMENSION))]
        public D3D11_TEX2DMS_ARRAY_RTV Texture2DMSArray;            //    D3D11_TEX2DMS_ARRAY_RTV Texture2DMSArray;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_RTV_DIMENSION))]
        public D3D11_TEX3D_RTV Texture3D;                           //    D3D11_TEX3D_RTV Texture3D;
                                                                    //    } 	;
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_D3D11_RENDER_TARGET_VIEW_DESC
    {
        public D3D11_RENDER_TARGET_VIEW_DESC Value;
    }
    #endregion
    public struct D3D11_VIEWPORT
    {
        public float TopLeftX;                                      //FLOAT TopLeftX;
        public float TopLeftY;                                      //FLOAT TopLeftY;
        public float Width;                                         //FLOAT Width;
        public float Height;                                        //FLOAT Height;
        public float MinDepth;                                      //FLOAT MinDepth;
        public float MaxDepth;                                      //FLOAT MaxDepth;
    }
    #region D3D11_TEXTURE1D_DESC
    public struct D3D11_TEXTURE1D_DESC
    {
        public uint Width;                                          //UINT Width;
        public uint MipLevels;                                      //UINT MipLevels;
        public uint ArraySize;                                      //UINT ArraySize;
        public DXGI_FORMAT Format;                                  //DXGI_FORMAT Format;
        public D3D11_USAGE Usage;                                   //D3D11_USAGE Usage;
        public uint BindFlags;                                      //UINT BindFlags;
        public uint CPUAccessFlags;                                 //UINT CPUAccessFlags;
        public uint MiscFlags;                                      //UINT MiscFlags;
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_D3D11_TEXTURE1D_DESC
    {
        public D3D11_TEXTURE1D_DESC Value;
    }
    #endregion
    [StructLayout(LayoutKind.Explicit)]
    public struct D3D11_BUFFER_SRV
    {
        [FieldOffset(0)]                                            //union 
        public uint FirstElement;                                   //    {
        [FieldOffset(0)]                                            //    UINT FirstElement;
        public uint ElementOffset;                                  //    UINT ElementOffset;
                                                                    //    } 	;
        [FieldOffset(sizeof(uint))]                                 //union 
        public uint NumElements;                                    //    {
        [FieldOffset(sizeof(uint))]                                 //    UINT NumElements;
        public uint ElementWidth;                                   //    UINT ElementWidth;
                                                                    //    } 	;
    }
    public struct D3D11_TEX1D_SRV
    {
        public uint MostDetailedMip;
        public uint MipLevels;
    }
    public struct D3D11_TEX1D_ARRAY_SRV
    {
        public uint MostDetailedMip;
        public uint MipLevels;
        public uint FirstArraySlice;
        public uint ArraySize;
    }
    public struct D3D11_TEX2D_SRV
    {
        public uint MostDetailedMip;
        public uint MipLevels;
    }
    public struct D3D11_TEX2D_ARRAY_SRV
    {
        public uint MostDetailedMip;
        public uint MipLevels;
        public uint FirstArraySlice;
        public uint ArraySize;
    }
    public struct D3D11_TEX2DMS_SRV
    {
        public uint UnusedField_NothingToDefine;
    }
    public struct D3D11_TEX2DMS_ARRAY_SRV
    {
        public uint FirstArraySlice;
        public uint ArraySize;
    }
    public struct D3D11_TEX3D_SRV
    {
        public uint MostDetailedMip;
        public uint MipLevels;
    }
    public struct D3D11_TEXCUBE_SRV
    {
        public uint MostDetailedMip;
        public uint MipLevels;
    }
    public struct D3D11_TEXCUBE_ARRAY_SRV
    {
        public uint MostDetailedMip;
        public uint MipLevels;
        public uint First2DArrayFace;
        public uint NumCubes;
    }
    public struct D3D11_BUFFEREX_SRV
    {
        public uint FirstElement;
        public uint NumElements;
        public D3D11_BUFFEREX_SRV_FLAG Flags;
    }
    #region D3D11_SHADER_RESOURCE_VIEW_DESC
    [StructLayout(LayoutKind.Explicit)]
    public struct D3D11_SHADER_RESOURCE_VIEW_DESC
    {
        [FieldOffset(0)]
        public DXGI_FORMAT Format;                                  //DXGI_FORMAT Format;          
        [FieldOffset(sizeof(DXGI_FORMAT))]
        public D3D_SRV_DIMENSION ViewDimension;                     //D3D11_SRV_DIMENSION ViewDimension;
                                                                    //union 
                                                                    //    {
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D_SRV_DIMENSION))]
        public D3D11_BUFFER_SRV Buffer;                             //    D3D11_BUFFER_SRV Buffer;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D_SRV_DIMENSION))]
        public D3D11_TEX1D_SRV Texture1D;                           //    D3D11_TEX1D_SRV Texture1D;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D_SRV_DIMENSION))]
        public D3D11_TEX1D_ARRAY_SRV Texture1DArray;                //    D3D11_TEX1D_ARRAY_SRV Texture1DArray;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D_SRV_DIMENSION))]
        public D3D11_TEX2D_SRV Texture2D;                           //    D3D11_TEX2D_SRV Texture2D;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D_SRV_DIMENSION))]
        public D3D11_TEX2D_ARRAY_SRV Texture2DArray;                //    D3D11_TEX2D_ARRAY_SRV Texture2DArray;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D_SRV_DIMENSION))]
        public D3D11_TEX2DMS_SRV Texture2DMS;                       //    D3D11_TEX2DMS_SRV Texture2DMS;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D_SRV_DIMENSION))]
        public D3D11_TEX2DMS_ARRAY_SRV Texture2DMSArray;            //    D3D11_TEX2DMS_ARRAY_SRV Texture2DMSArray;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D_SRV_DIMENSION))]
        public D3D11_TEX3D_SRV Texture3D;                           //    D3D11_TEX3D_SRV Texture3D;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D_SRV_DIMENSION))]
        public D3D11_TEXCUBE_SRV TextureCube;                       //    D3D11_TEXCUBE_SRV TextureCube;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D_SRV_DIMENSION))]
        public D3D11_TEXCUBE_ARRAY_SRV TextureCubeArray;            //    D3D11_TEXCUBE_ARRAY_SRV TextureCubeArray;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D_SRV_DIMENSION))]
        public D3D11_BUFFEREX_SRV BufferEx;                         //    D3D11_BUFFEREX_SRV BufferEx;
                                                                    //    } 	;
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_D3D11_SHADER_RESOURCE_VIEW_DESC
    {
        public D3D11_SHADER_RESOURCE_VIEW_DESC Value;
    }
    #endregion
    public struct D3D11_BUFFER_UAV
    {
        public uint FirstElement;
        public uint NumElements;
        public D3D11_BUFFER_UAV_FLAG Flags;
    }
    public struct D3D11_TEX1D_UAV
    {
        public uint MipSlice;
    }
    public struct D3D11_TEX1D_ARRAY_UAV
    {
        public uint MipSlice;
        public uint FirstArraySlice;
        public uint ArraySize;
    }
    public struct D3D11_TEX2D_UAV
    {
        public uint MipSlice;
    }
    public struct D3D11_TEX2D_ARRAY_UAV
    {
        public uint MipSlice;
        public uint FirstArraySlice;
        public uint ArraySize;
    }
    public struct D3D11_TEX3D_UAV
    {
        public uint MipSlice;
        public uint FirstWSlice;
        public uint WSize;
    }
    #region D3D11_UNORDERED_ACCESS_VIEW_DESC
    [StructLayout(LayoutKind.Explicit)]
    public struct D3D11_UNORDERED_ACCESS_VIEW_DESC
    {
        [FieldOffset(0)]
        public DXGI_FORMAT Format;                                  //DXGI_FORMAT Format;
        [FieldOffset(sizeof(DXGI_FORMAT))]
        public D3D11_UAV_DIMENSION ViewDimension;                   //D3D11_UAV_DIMENSION ViewDimension;
                                                                    //union 
                                                                    //    {
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_UAV_DIMENSION))]
        public D3D11_BUFFER_UAV Buffer;                             //    D3D11_BUFFER_UAV Buffer;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_UAV_DIMENSION))]
        public D3D11_TEX1D_UAV Texture1D;                           //    D3D11_TEX1D_UAV Texture1D;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_UAV_DIMENSION))]
        public D3D11_TEX1D_ARRAY_UAV Texture1DArray;                //    D3D11_TEX1D_ARRAY_UAV Texture1DArray;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_UAV_DIMENSION))]
        public D3D11_TEX2D_UAV Texture2D;                           //    D3D11_TEX2D_UAV Texture2D;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_UAV_DIMENSION))]
        public D3D11_TEX2D_ARRAY_UAV Texture2DArray;                //    D3D11_TEX2D_ARRAY_UAV Texture2DArray;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_UAV_DIMENSION))]
        public D3D11_TEX3D_UAV Texture3D;                           //    D3D11_TEX3D_UAV Texture3D;
                                                                    //    } 	;
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_D3D11_UNORDERED_ACCESS_VIEW_DESC
    {
        public D3D11_UNORDERED_ACCESS_VIEW_DESC Value;
    }
    #endregion
    public struct D3D11_TEX1D_DSV
    {
        public uint MipSlice;                                  //UINT MipSlice;
    }
    public struct D3D11_TEX1D_ARRAY_DSV
    {
        public uint MipSlice;                           //UINT MipSlice;
        public uint FirstArraySlice;                    //UINT FirstArraySlice;
        public uint ArraySize;                          //UINT ArraySize;
    }
    public struct D3D11_TEX2D_DSV
    {
        public uint MipSlice;                                  //UINT MipSlice;
    }
    public struct D3D11_TEX2D_ARRAY_DSV
    {
        public uint MipSlice;                           //UINT MipSlice;
        public uint FirstArraySlice;                    //UINT FirstArraySlice;
        public uint ArraySize;                          //UINT ArraySize;
    }
    public struct D3D11_TEX2DMS_DSV
    {
        public uint UnusedField_NothingToDefine;        //UINT UnusedField_NothingToDefine;
    }
    public struct D3D11_TEX2DMS_ARRAY_DSV
    {
        public uint FirstArraySlice;                    //UINT FirstArraySlice;
        public uint ArraySize;                          //UINT ArraySize;
    }
    #region D3D11_DEPTH_STENCIL_VIEW_DESC
    [StructLayout(LayoutKind.Explicit)]
    public struct D3D11_DEPTH_STENCIL_VIEW_DESC
    {
        [FieldOffset(0)]
        public DXGI_FORMAT Format;                              //DXGI_FORMAT Format;
        [FieldOffset(sizeof(DXGI_FORMAT))]
        public D3D11_DSV_DIMENSION ViewDimension;               //D3D11_DSV_DIMENSION ViewDimension;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_DSV_DIMENSION))]
        public D3D11_DSV_FLAG Flags;                            //UINT Flags;
                                                                //union 
                                                                //    {
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_DSV_DIMENSION) + sizeof(D3D11_DSV_FLAG))]
        public D3D11_TEX1D_DSV Texture1D;                       //    D3D11_TEX1D_DSV Texture1D;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_DSV_DIMENSION) + sizeof(D3D11_DSV_FLAG))]
        public D3D11_TEX1D_ARRAY_DSV Texture1DArray;            //    D3D11_TEX1D_ARRAY_DSV Texture1DArray;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_DSV_DIMENSION) + sizeof(D3D11_DSV_FLAG))]
        public D3D11_TEX2D_DSV Texture2D;                       //    D3D11_TEX2D_DSV Texture2D;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_DSV_DIMENSION) + sizeof(D3D11_DSV_FLAG))]
        public D3D11_TEX2D_ARRAY_DSV Texture2DArray;            //    D3D11_TEX2D_ARRAY_DSV Texture2DArray;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_DSV_DIMENSION) + sizeof(D3D11_DSV_FLAG))]
        public D3D11_TEX2DMS_DSV Texture2DMS;                   //    D3D11_TEX2DMS_DSV Texture2DMS;
        [FieldOffset(sizeof(DXGI_FORMAT) + sizeof(D3D11_DSV_DIMENSION) + sizeof(D3D11_DSV_FLAG))]
        public D3D11_TEX2DMS_ARRAY_DSV Texture2DMSArray;        //    D3D11_TEX2DMS_ARRAY_DSV Texture2DMSArray;
                                                                //    } 	;
    }
    [StructLayout(LayoutKind.Sequential)]
    public class LP_D3D11_DEPTH_STENCIL_VIEW_DESC
    {
        public D3D11_DEPTH_STENCIL_VIEW_DESC Value;
    }
    #endregion
    #region D3D11_INPUT_ELEMENT_DESC
    public struct D3D11_INPUT_ELEMENT_DESC
    {
        public IntPtr SemanticName;                         //LPCSTR SemanticName;
        public uint SemanticIndex;                          //UINT SemanticIndex;
        public DXGI_FORMAT Format;                          //DXGI_FORMAT Format;
        public uint InputSlot;                              //UINT InputSlot;
        public uint AlignedByteOffset;                      //UINT AlignedByteOffset;
        public D3D11_INPUT_CLASSIFICATION InputSlotClass;   //D3D11_INPUT_CLASSIFICATION InputSlotClass;
        public uint InstanceDataStepRate;                   //UINT InstanceDataStepRate;
        public void Free()                                  // Notice: Must call Free() yourself, after use.
        {
            if (SemanticName != IntPtr.Zero) Marshal.FreeHGlobal(SemanticName);
        }
    }
    public class D3D11_INPUT_ELEMENT_DESC_M                         // Notice: Memory Copy. Notice: not struct but class and not formatted(without StructLayout). - should not be pinned but only be used in Extensions
    {
        public string SemanticName;                                 //LPCSTR SemanticName;
        public uint SemanticIndex;                                  //UINT SemanticIndex;
        public DXGI_FORMAT Format;                                  //DXGI_FORMAT Format;
        public uint InputSlot;                                      //UINT InputSlot;
        public uint AlignedByteOffset;                              //UINT AlignedByteOffset;
        public D3D11_INPUT_CLASSIFICATION InputSlotClass;           //D3D11_INPUT_CLASSIFICATION InputSlotClass;
        public uint InstanceDataStepRate;                           //UINT InstanceDataStepRate;
        public static implicit operator D3D11_INPUT_ELEMENT_DESC_M(D3D11_INPUT_ELEMENT_DESC value)
        {
            return new D3D11_INPUT_ELEMENT_DESC_M()
            {
                SemanticName = Marshal.PtrToStringAnsi(value.SemanticName),
                SemanticIndex = value.SemanticIndex,
                Format = value.Format,
                InputSlot = value.InputSlot,
                AlignedByteOffset = value.AlignedByteOffset,
                InputSlotClass = value.InputSlotClass,
                InstanceDataStepRate = value.InstanceDataStepRate,
            };
        }
        public static implicit operator D3D11_INPUT_ELEMENT_DESC(D3D11_INPUT_ELEMENT_DESC_M value)
        {
            return new D3D11_INPUT_ELEMENT_DESC()
            {
                SemanticName = Marshal.StringToHGlobalAnsi(value.SemanticName),
                SemanticIndex = value.SemanticIndex,
                Format = value.Format,
                InputSlot = value.InputSlot,
                AlignedByteOffset = value.AlignedByteOffset,
                InputSlotClass = value.InputSlotClass,
                InstanceDataStepRate = value.InstanceDataStepRate,
            };
        }
    }
    #endregion
    public struct D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS
    {
        public int ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x;
    }
    public struct D3D11_FEATURE_DATA_DOUBLES
    {
        public int DoublePrecisionFloatShaderOps;
    }
    public struct D3D11_MAPPED_SUBRESOURCE
    {
        public IntPtr pData;
        public uint RowPitch;
        public uint DepthPitch;
    }
    public struct D3D11_CLASS_INSTANCE_DESC
    {
        public uint InstanceId;                 //UINT InstanceId;
        public uint InstanceIndex;              //UINT InstanceIndex;
        public uint TypeId;                     //UINT TypeId;
        public uint ConstantBuffer;             //UINT ConstantBuffer;
        public uint BaseConstantBufferOffset;   //UINT BaseConstantBufferOffset;
        public uint BaseTexture;                //UINT BaseTexture;
        public uint BaseSampler;                //UINT BaseSampler;
        public int Created;                     //BOOL Created;
    }
    #region D3D11_SO_DECLARATION_ENTRY
    public struct D3D11_SO_DECLARATION_ENTRY
    {
        public uint Stream;                     //UINT Stream;
        public IntPtr SemanticName;             //LPCSTR SemanticName;
        public uint SemanticIndex;              //UINT SemanticIndex;
        public byte StartComponent;             //BYTE StartComponent;
        public byte ComponentCount;             //BYTE ComponentCount;
        public byte OutputSlot;                 //BYTE OutputSlot;
        public void Free()                      // Notice: Must call Free() yourself, after use.
        {
            if (SemanticName != IntPtr.Zero) Marshal.FreeHGlobal(SemanticName);
        }
    }
    public class D3D11_SO_DECLARATION_ENTRY_M   // Notice: Memory Copy. Notice: not struct but class and not formatted(without StructLayout). - should not be pinned but only be used in Extensions
    {
        public uint Stream;                     //UINT Stream;
        public string SemanticName;             //LPCSTR SemanticName;
        public uint SemanticIndex;              //UINT SemanticIndex;
        public byte StartComponent;             //BYTE StartComponent;
        public byte ComponentCount;             //BYTE ComponentCount;
        public byte OutputSlot;                 //BYTE OutputSlot;
        public static implicit operator D3D11_SO_DECLARATION_ENTRY_M(D3D11_SO_DECLARATION_ENTRY value)
        {
            return new D3D11_SO_DECLARATION_ENTRY_M()
            {
                Stream = value.Stream,
                SemanticName = Marshal.PtrToStringAnsi(value.SemanticName),
                SemanticIndex = value.SemanticIndex,
                StartComponent = value.StartComponent,
                ComponentCount = value.ComponentCount,
                OutputSlot = value.OutputSlot,
            };
        }
        public static implicit operator D3D11_SO_DECLARATION_ENTRY(D3D11_SO_DECLARATION_ENTRY_M value)
        {
            return new D3D11_SO_DECLARATION_ENTRY()
            {
                Stream = value.Stream,
                SemanticName = Marshal.StringToHGlobalAnsi(value.SemanticName),
                SemanticIndex = value.SemanticIndex,
                StartComponent = value.StartComponent,
                ComponentCount = value.ComponentCount,
                OutputSlot = value.OutputSlot,
            };
        }
    }
    #endregion
    public struct D3D11_RENDER_TARGET_BLEND_DESC
    {
        public int BlendEnable;                 //BOOL BlendEnable;
        public D3D11_BLEND SrcBlend;            //D3D11_BLEND SrcBlend;
        public D3D11_BLEND DestBlend;           //D3D11_BLEND DestBlend;
        public D3D11_BLEND_OP BlendOp;          //D3D11_BLEND_OP BlendOp;
        public D3D11_BLEND SrcBlendAlpha;       //D3D11_BLEND SrcBlendAlpha;
        public D3D11_BLEND DestBlendAlpha;      //D3D11_BLEND DestBlendAlpha;
        public D3D11_BLEND_OP BlendOpAlpha;     //D3D11_BLEND_OP BlendOpAlpha;
        public byte RenderTargetWriteMask;      //UINT8 RenderTargetWriteMask;
    }
    public struct D3D11_BLEND_DESC
    {
        public int AlphaToCoverageEnable;   //BOOL AlphaToCoverageEnable;
        public int IndependentBlendEnable;  //BOOL IndependentBlendEnable;
                                            //D3D11_RENDER_TARGET_BLEND_DESC RenderTarget[ 8 ];
        public D3D11_RENDER_TARGET_BLEND_DESC RenderTarget0;
        public D3D11_RENDER_TARGET_BLEND_DESC RenderTarget1;
        public D3D11_RENDER_TARGET_BLEND_DESC RenderTarget2;
        public D3D11_RENDER_TARGET_BLEND_DESC RenderTarget3;
        public D3D11_RENDER_TARGET_BLEND_DESC RenderTarget4;
        public D3D11_RENDER_TARGET_BLEND_DESC RenderTarget5;
        public D3D11_RENDER_TARGET_BLEND_DESC RenderTarget6;
        public D3D11_RENDER_TARGET_BLEND_DESC RenderTarget7;
    }
    public struct D3D11_DEPTH_STENCILOP_DESC
    {
        public D3D11_STENCIL_OP StencilFailOp;      //D3D11_STENCIL_OP StencilFailOp;
        public D3D11_STENCIL_OP StencilDepthFailOp; //D3D11_STENCIL_OP StencilDepthFailOp;
        public D3D11_STENCIL_OP StencilPassOp;      //D3D11_STENCIL_OP StencilPassOp;
        public D3D11_COMPARISON_FUNC StencilFunc;   //D3D11_COMPARISON_FUNC StencilFunc;
    }
    public struct D3D11_DEPTH_STENCIL_DESC
    {
        public int DepthEnable;                         //BOOL DepthEnable;
        public D3D11_DEPTH_WRITE_MASK DepthWriteMask;   //D3D11_DEPTH_WRITE_MASK DepthWriteMask;
        public D3D11_COMPARISON_FUNC DepthFunc;         //D3D11_COMPARISON_FUNC DepthFunc;
        public int StencilEnable;                       //BOOL StencilEnable;
        public byte StencilReadMask;                    //UINT8 StencilReadMask;
        public byte StencilWriteMask;                   //UINT8 StencilWriteMask;
        public D3D11_DEPTH_STENCILOP_DESC FrontFace;    //D3D11_DEPTH_STENCILOP_DESC FrontFace;
        public D3D11_DEPTH_STENCILOP_DESC BackFace;     //D3D11_DEPTH_STENCILOP_DESC BackFace;
    }
    public struct D3D11_RASTERIZER_DESC
    {
        public D3D11_FILL_MODE FillMode;    //D3D11_FILL_MODE FillMode;
        public D3D11_CULL_MODE CullMode;    //D3D11_CULL_MODE CullMode;
        public int FrontCounterClockwise;   //BOOL FrontCounterClockwise;
        public int DepthBias;               //INT DepthBias;
        public float DepthBiasClamp;        //FLOAT DepthBiasClamp;
        public float SlopeScaledDepthBias;  //FLOAT SlopeScaledDepthBias;
        public int DepthClipEnable;         //BOOL DepthClipEnable;
        public int ScissorEnable;           //BOOL ScissorEnable;
        public int MultisampleEnable;       //BOOL MultisampleEnable;
        public int AntialiasedLineEnable;   //BOOL AntialiasedLineEnable;
    }
    public struct D3D11_SAMPLER_DESC
    {
        public D3D11_FILTER Filter;                 //D3D11_FILTER Filter;
        public D3D11_TEXTURE_ADDRESS_MODE AddressU; //D3D11_TEXTURE_ADDRESS_MODE AddressU;
        public D3D11_TEXTURE_ADDRESS_MODE AddressV; //D3D11_TEXTURE_ADDRESS_MODE AddressV;
        public D3D11_TEXTURE_ADDRESS_MODE AddressW; //D3D11_TEXTURE_ADDRESS_MODE AddressW;
        public float MipLODBias;                    //FLOAT MipLODBias;
        public uint MaxAnisotropy;                  //UINT MaxAnisotropy;
        public D3D11_COMPARISON_FUNC ComparisonFunc;//D3D11_COMPARISON_FUNC ComparisonFunc;
                                                    //FLOAT BorderColor[ 4 ];
        public float BorderColor0;
        public float BorderColor1;
        public float BorderColor2;
        public float BorderColor3;
        public float MinLOD;                        //FLOAT MinLOD;
        public float MaxLOD;                        //FLOAT MaxLOD;
    }
    public struct D3D11_QUERY_DESC
    {
        public D3D11_QUERY Query;   //D3D11_QUERY Query;
        public uint MiscFlags;      //UINT MiscFlags;
    }
    public struct D3D11_COUNTER_DESC
    {
        public D3D11_COUNTER Counter;   //D3D11_COUNTER Counter;
        public uint MiscFlags;          //UINT MiscFlags;
    }
    public struct D3D11_COUNTER_INFO
    {
        public D3D11_COUNTER LastDeviceDependentCounter;    //D3D11_COUNTER LastDeviceDependentCounter;
        public uint NumSimultaneousCounters;                //UINT NumSimultaneousCounters;
        public byte NumDetectableParallelUnits;             //UINT8 NumDetectableParallelUnits;
    }
    public struct D3D11_RECT
    {
        public int left;
        public int top;
        public int right;
        public int bottom;
    }
    public struct D3D11_BOX
    {
        public uint left;
        public uint top;
        public uint front;
        public uint right;
        public uint bottom;
        public uint back;
    }
    [StructLayout(LayoutKind.Sequential)]
    public struct D3D_SHADER_MACRO
    {
        [MarshalAs(UnmanagedType.LPStr)]
        public string Name;
        [MarshalAs(UnmanagedType.LPStr)]
        public string Definition;
    }
    #endregion
    #endregion
}
